Author Archives: vonger

vohttpd: current process

Recently I am busy on vohttpd 🙂 VoCore should have a light weight and powerful httpd(NOTE2), so we can make IoT web interface easier.(save memory and flash will reduce the cost too 🙂 )
I am new to web develop, so the process on http/javascript is very slow 🙂 But I am good at net/c develop, that part is going well.
Currently I have finished the vohttpd main application, now just consider the framework for the web side interface. I want it to be very simple and modularized.

This is my dreamed embedded httpd application:
1. light weight. even able to run on 8~16MB memory device.
normal memory usage < 60KB(NOTE1), or even < 20KB in low performance situation. 2. flexible. we can drag & drop plugin into browser, then the embedded device will have such function. For example: to enable webcam function, we just need to drop the install package into browser, it will install all necessary compose. and show the webcam video on browser. 3. easy to develop. it should have only a few( < 10) necessary api for the plugin. I hate read documentations; also hate write them. 🙂 A developer who knows some basic C language(mainly is for string) will able to develop plugin. User Interface should be all in web side. Plugins should only provide the function, like webapi. The javascript make the logic for the UI, bootstrap and html for the widgets on the UI. 4. fast speed, stable, etc... I write a simple plugin control interface, based on bootstrap and jquery. source code can be find at http://github.com/vonger/vohttpd. I am still learning this, the interface will be upgrade later. Now it is able to compile and run on linux, macos, windows(mingw). Browser: firefox, chrome, ie. Screen Shot 2014-12-24 at 21.33.51

Screen Shot 2014-12-24 at 21.33.57

NOTE1: this memory usage is the application alloced memory, system memory is not contained. It is about 200KB~300KB in total. That is used to shared libraries, plugins, etc.
NOTE2: I compared and tried many httpd applications, none of them made me happy, in my last blog I explained that.

VoCore: Returned Package 1

Here are some packages returned from China Post, please check if there is your package. Most of them are incorrect address. (After 4~6 months, some people might already move to new place). If your trace id is in the list, please email your new address to support@vocore.io.

RC127346697CN
RC127346958CN
RC127346520CN
RI077512791CN
RI077509758CN
RI077513474CN
RI077511615CN
RI077510549CN
RI077511195CN
RI077512403CN
RI077510875CN
RI077508528CN
RI077512448CN
RI077510645CN
RI077509293CN

VoCore: StarterKit Breakout Board

VoCore breakout board will have such features:

1. two ethernet ports.
2. jtag port, 2.54mm pins, with 10k ohm pull up resistors.
3. gpio port, 2.54mm pins, with 4.7k ohm pull up resistors.(some for boot stripe has pull down)
4. reset button.(with 4.7k ohm pull up)
5. spi port, 2.54mm pins.
6. micro USB power in.
7. uart full port, 2.54mm pins.
8. usb 2.0.
9. size about 6cm x 4cm

consider to add to this breakout board:
1. arduino chip and pins export.
2. on board usb2ttl chip.

Former layout:
layout

VoCore: wireless printer & usbip

Plan to use usbip upgrade my cheap printer(Epson ME350) into a wireless printer, also a wireless scanner.
But just find it is very hard to complete that.

There is kmod-usbip-client, kmod-usbip-server in the openwrt truck, but I just can not find usbipd, that is a important compose for transfer data to client computer. As I remember, it is there in old openwrt truck…

If I can not find any exist package, I have to rewrite part of that usbipd, to make it work.
usbipd is based on glibc…but current openwrt is using ulibc, can not compile directly.
Only this middle adapter application missed…I am so eager to try usbip control my printer wirelessly. 🙂

VoCore: MJPG Camera

Prepare:
1. necessary library(openwrt must have video support)
(if you do not know how to compile it, download here packages, or full firmware(no luci):
kmod-video-core_3.14.25-1_ramips_24kec.ipk
kmod-video-uvc_3.14.25-1_ramips_24kec.ipk
kmod-video-videobuf2_3.14.25-1_ramips_24kec.ipk
libjpeg_9a-1_ramips_24kec.ipk
mjpg-streamer_r182-2_ramips_24kec.ipk

copy all of them to vocore:
scp kmod-video-core_3.14.25-1_ramips_24kec.ipk root@192.168.61.1:/tmp/
scp kmod-video-videobuf2_3.14.25-1_ramips_24kec.ipk root@192.168.61.1:/tmp/
scp kmod-video-uvc_3.14.25-1_ramips_24kec.ipk root@192.168.61.1:/tmp/
scp libjpeg_9a-1_ramips_24kec.ipk root@192.168.61.1:/tmp/
scp mjpg-streamer_r182-2_ramips_24kec.ipk root@192.168.61.1:/tmp/

ssh to vocore, install:
opkg install /tmp/kmod-video-core_3.14.25-1_ramips_24kec.ipk
opkg install /tmp/kmod-video-videobuf2_3.14.25-1_ramips_24kec.ipk
opkg install /tmp/kmod-video-uvc_3.14.25-1_ramips_24kec.ipk
opkg install /tmp/libjpeg_9a-1_ramips_24kec.ipk
opkg install /tmp/mjpg-streamer_r182-2_ramips_24kec.ipk

2. one usb mjpg camera. mine get from taobao.com, cost about 12USD.
IMG_0203

3.a vocore, need to connect with USB D+/D- and give the webcam 5V power.
3.b vocore + dock, this is much easier, directly connect to dock usb port.
IMG_0202

Now, run

/usr/bin/mjpg_streamer -i "input_uvc.so -d /dev/video0 -resolution 320x240" -o "output_http.so -www /www/webcam"

(Note: “/etc/init.d/mjpg-streamer start” not working, have to call it directly)
Screen Shot 2014-12-06 at 6.01.35 PM

Try with your browser 🙂 Plan to write a plugin for vohttpd, to make this easier.
http://192.168.61.1:8080/?action=stream

Looks like my webcam is a little short sight…
camear

VoCore: SPI & MicroSD 12

Finally it works 🙂 But still not perfect.
Thanks for noltari find the problem. Just change spi speed line in dts, then it works.

Here is the patch and new spi-rt2880.c(rewrite by noltari)
vocore_spi_sd_#1
spi-rt2880

Here is the screen capture.
Screen Shot 2014-12-04 at 5.46.30 PM

PS: here is the patch of VoCoreopenwrt-vocore patch
1. change ap to VoCore to avoid ap name conflict with other openwrt device.
2. change default ip to 192.168.61.1 to avoid ap+sta mode ip conflict.
3. change shadow file, so there is default password “vocore”
4. change dts flash partition to fit 16MB flash.(keep the line if you are using 8MB version vocore)

Here is the link of compiled firmware: vocore.16m.microsd.bin

vohttpd: light weight embeded httpd

VoCore Web Server change its name to vohttpd.
A former version has released and put into GitHub: https://github.com/vonger/vohttpd
My target is to make a httpd who has faster speed and less resource consume, the most important, it should be flexible, easy to add plugins.

vohttpd should be a basic core do not contains any unnecessary features, its main target is to provide an environment for plugins. Any features could be move to plugins and they should not appear in the core application.

Plugins are the most important part. For example, if I want to have a browser based user interface for gpio control(as my last blog shows), I just write a plugin and use vohttpd API to load that plugin, then it will be OK to use. If I connect VoCore to a mjpeg webcam, I can get picture directly from browser, do not have to code a middle adapter.
Future, we can add more javascript for the client side, just draw&drop the plugin into the browser, all function will be automatic load to VoCore, that will be cool.

Super simple, and born to be cross platform. 🙂

For now, load/unload/query plugins feature has done. In source code, there are two example plugins, one for test, one for online plugin control, such as upload plugin or remove plugin.

load

There are a lot of work left to do:
1. use mmap for better memory usage when receiving big file.
2. add https as an option.
3. add auth function. (But make it as plugin? or make it into vohttpd?)

I am glad to hear from you. Please leave a comment.

PS: I spend time on this project just because I really need something like this for my further use, and the development process is very interesting. 🙂 I do not intend to replace any exists httpd, such as LuCI, uhttpd etc. They are very good too.

VoCore: Package FAQ

There are mainly two type of packages:

VoCore
1. VoCore, main board version
a) 4x4p female connectors.
b) 4x7p female connectors.
c) USB convert to TTL, driver PL2302.

VoCore + Dock
2. VoCore + Dock
a) 1x4p female connectors.
b) 3x7p female connectors.
c) USB convert to TTL, driver PL2302.

What are those addition female connectors used to do?
They are used to solder on the pin holes to make them stand longer.
1.27mm female connectors are hard to find in some countries, so I add that to the package, but that is not necessary at all. From current report, the female connectors did not help much, just lead a few people broken down VoCore when they trying to solder the connectors. I am thinking to remove it in further package.
For beginner, a break out board is necessary, so people will not afraid of broken their little VoCore. 🙂 I am on that now.

PS: I thought the buyers of VoCore should have enough skill to solder that, but I am totally wrong. That’s my bad. 🙂

What is that USB2TTL used to do?
That USB2TTL is very important. It helps you repair the bricked VoCore by uboot or connect to VoCore when your wifi or ethernet do not work.
When I write driver for VoCore, I always make stupid mistake, such as system can not reboot or too heavy CPU load, make the wifi can not work normal. For such situation, USB2TTL is the only way to connect to VoCore(maybe JTAG is fine too, but I did not try).

Next version I will consider to add USB2TTL chip to dock, but the space on dock is so limited, that QFN chip + slot parts is not easy to assemble.
This move must be very careful 🙂

How to detach the VoCore and the Dock?
That is not easy, due to there are almost 20 pins tightly connected together and the pin are long, 14mm, easy to bend.
There is no glue between the VoCore main board and the dock, the white one is just silicone grease make the CPU well touch the ethernet port which is used to be a heat sink.

Detach the VoCore + Dock, two keywords are “vertical” and “slow”, the pin into the female connector about 1.4mm, if you do not do it vertical, the pin might bend.

IMG_0198

VoCore: Starter Tutorial Part2

IMG_0196 (1)

About GPIO, I post a blog when I start VoCore.
Please check this link http://vonger.cn/?p=473.

There is some note about how to finish this:

Connection:

Screen Shot 2014-11-21 at 7.03.13 PM

That 330ohm resistor is necessary, without it, the LED will burn.

Command:
Already in this post http://vonger.cn/?p=473.

Advance:

We can write an API for this LED control, so we can simply control it from browser remotely 🙂 phone, computer, pad, anything have broswer.

Here is the code, based on VoWeb, just add one function:

int voweb_func_gpio0ctrl(socket_data *d, string_reference *pa)
{
    char buf[MESSAGE_SIZE] = "Invalid parameter.";
    FILE *fp;

    fp = fopen("/sys/class/gpio/gpio0/direction", "w");
    if(fp == NULL) {
        sprintf(buf, "update gpio 0 direction failed.");
        return send(d->sock, buf, strlen(buf), 0);
    }
    fwrite("out", 1, 4, fp);
    fclose(fp);

    if(memcmp(pa->ref, "on", 2) == 0) {
        fp = fopen("/sys/class/gpio/gpio0/value", "w");
        if(fp != NULL) {
            fwrite("1", 1, 2, fp);
            fclose(fp);

            sprintf(buf, "update gpio 0 value to 1 success.");
        } else {
            sprintf(buf, "update gpio 0 value to 1 failed.");
        }
    }
    if(memcmp(pa->ref, "off", 3) == 0) {
        fp = fopen("/sys/class/gpio/gpio0/value", "w");
        if(fp != NULL) {
            fwrite("0", 1, 2, fp);
            fclose(fp);

            sprintf(buf, "update gpio 0 value to 0 success.");
        } else {
            sprintf(buf, "update gpio 0 value to 0 failed.");
        }
    }

    return send(d->sock, buf, strlen(buf), 0);
}

And register this function:

string_hash_set(funcs, "gpio0ctrl", (uchar *)voweb_func_gpio0ctrl);

Here is compiled one and necessary html: download

Uncompress vocore.voweb.gpio.test.zip to local folder, such as “~/voweb.gpio”, and scp all of the files to root@192.168.61.1:~/

scp -r ~/voweb.gpio/* root@192.168.61.1:~/

Then run command in vocore.

/root/voweb 8080 /root/html

Just open 192.168.61.1:8080, you will find this page, now, just click on the switch, the LED is under your control.

Here is a simple video:

Any questions, just leave a comment under. 🙂
brandonhead, I like your question 😀

vonger.cn: Speed Up

There are many people in China report issue to me, my blog is very hard to open, today I find the problem finally…
WordPress load google fonts at head part, but in China the Great Firewall block all google address. So the load process is very very very slow.

Get the bad code in /var/www/html

find . | xargs grep 'fonts.google' 2> /dev/null:

Comment all of them, now the user from China or other country blocked google can view it much much faster 🙂