VoCore: No LuCI 3

From last week, I am thinking of a super light weight web server.
There are many choices:
LuCI + uhttpd, goahead, mini-httpd, etc…

But none of them is perfect for me:

1. cgi part use too much resource.
Fork new child process to deal cgi, and dealing code with Lua. Calling script to create the html page. If I need update frequently, such as video, the board will die for out of memory or cpu 100%.

2. memory control low efficiency.
They call malloc for every memory request. For small memory device, such malloc is pain. It will generate tons of memory fragment, and the core have to arrange them, costs lots of resource.

3. unnecessary optimisation.
We just has one core, so whatever the optimisation you do, remember the most effect way is to make the app run in one thread.
Such on board web server do not have to deal with many people request same time, so use why use pthread? Looks like the reply time is shorter, but underground it costs two times of CPU time, if the load is heavy, it is twice slower.

4. take too much disk(flash) space.
goahead, after I compile it, the size goes to 850KB, and even not contains its dependency library.

So same reason as I make VoCore, I write something looks better to me.

1. advanced memory control.
Only 12KB or even lower memory request. Self maintain memory, do not create memory fragment.

2. optimisation for one core cpu.
The full application only have just one thread, no switch cost.

3. cgi write in pure C code.
This makes it more effective, no middle layer. Pure server, client mode.

4. super fast.
deal 60~80/sec request on VoCore.

5. minimised dependency
Only basic C library is necessary. Do not need pthread, libdl, etc.

6. small executable file size.
After compile, it is 33KB, and do not need addition library. That’s all.

7. source code in one file.
I like sqlite3 style, so I make all files into one file, easy to compile.

This VoWebServer is very “embed”, of course, it is just a new project, many bugs have to be fixed, at least, we have one more choice. πŸ™‚

Here is the source code, once I feel happy about it, will upload to github.
compile it by one line:

cc -g voweb.c -o voweb

Compiled one for VoCore: voweb

run it like this:(put some htmls to /var/www/html, it will get index.html)

voweb 8080 /var/www/html

Then open 192.168.61.1:8080, you will find the page πŸ™‚
Test cgi function: http://192.168.61.1:8080/cgi-bin/love?VoCore
(cgi-bin folder do not exists)

VoCore: Starter Tutorial Part1

In this tutorial, I will show you the full process about setup a develop environment and compile/run a “hello world” on VoCore, step by step.

1. Prepare Linux
a) Download and install VirtualBox. VirtualBox is a famous open source VM software, I like it. If you are using Linux OS already, just ignore this.

https://www.virtualbox.org/wiki/Downloads

Screen Shot 2014-11-20 at 10.45.00 am

Click on the links, you will get the install package, run it to install VirtualBox into your computer. If you have VoCore you can not be a newbie to such thing.

b) Download Ubuntu. Ubuntu is the first UI Linux I used. I like the font πŸ™‚

http://www.ubuntu.com/download/
Screen Shot 2014-11-20 at 10.47.38 am

After download, you will get the ubuntu install iso file.

c) Setup VirtualBox and install ubuntu into it.
Screen Shot 2014-11-20 at 10.51.24 am (2)

Better to have 30GB free disk space(at least 20GB).
Screen Shot 2014-11-20 at 10.51.38 am (2)

Click “Create”, then double click the new item in VBox.
It will popup a window request you to select the iso.
Now select your downloaded ubuntu iso, then click Start.
Screen Shot 2014-11-20 at 10.51.59 am (2)

Rest is the install Ubuntu, I will not post here, please check ubuntu.com for the install instruction.

d) Install VirtualBox driver to ubuntu.
After ubuntu installed and startup successfully, we have to install VirtualBox driver so we can use the network, etc in VM.

Details is here: https://www.virtualbox.org/manual/UserManual.html

Now we have a Linux system in VM.

2. Prepare OpenWrt.(http://vocore.io/wiki/index/id:15)

a) Install necessary tools:
sudo apt-get install zlib1g-dev libncurses5-dev gawk subversion libssl-dev git

b) Download openwrt
git clone git://git.openwrt.org/openwrt.git

c) Make & Compile
goto openwrt folder(git create that), for example: cd ~/openwrt
make menuconfig
Screen Shot 2014-11-20 at 11.07.52 am (2)
make sure the config is like upper picture.

call make to compile openwrt, or make -jX for faster speed.(X is your CPU core number +1, for my macbook pro, it is -j9)

3. Write your first application.
use vi or any text edit, create main.c.

#include <stdio.h>

int main(void)
{
    return printf("hello world\n");
}

Now there are two ways to compile your main.c
One is to write a makefile, put the file to openwrt package folder, I will show this way in later tutorial.

Another way is super simple πŸ™‚ Just make sure main.c is in current folder.

`find . -name mipsel-openwrt-linux-gcc` -g main.c -o hello

Now you have the compiled application, hello.
Note: you might get this warning, just ignore that.

mipsel-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined

4. Upload to VoCore

a) Connect to your VoCore.

Here is the tutoral

VoCore: Simple Start Tutorial 1

VoCore: Simple Start Tutorial 2

b) scp the file to VoCore, password vocore.

scp ./hello root@192.168.61.1:/tmp/

c) ssh to VoCore.

ssh root@192.168.61.1

d) Try to run your first app.
Works well πŸ™‚
Screen Shot 2014-11-20 at 11.39.21 am (2)

Next tutorial, I will show how to remote control GPIO.

VoCore meet Edison in Beijing Maker Space

Yesterday I have been to Beijing Make(r) Space, find Edison there πŸ™‚

Here is some photo compare VoCore with Edison.
10685604_10204031380318627_2691113683851066857_n

10409143_10204031364398229_4125428993700240538_n

VoCore is much smaller πŸ™‚

1508084_10204031382278676_2530762614300675925_n

This bottom interface is rather not that friendly to hobbyist, if I only have the $50 Edison, I can not use it at all. That slot is hard to buy from everywhere, lol, compare to that, seems VoCore’s 1.27mm connectors are much easy to get. πŸ™‚ That is not the point, at least, I can solder wire to the 1.27mm holes, but I have no idea how to use Edison without its $79(?) breakout board.

Emm, I am a little disappoint. Last year, I was thinking Intel must making some wonderful thing, but the final result is just so so.

VoCore: Check Hardware

Here is some experience, I use them to locate where the VoCore broken, if you have a power supply show VoCore current, this might help.

1. input 5V, current first 0.12A then go 0.15A then 0.25A … your VoCore is normal to boot. When it is in uboot, the current consume is 0.12A~0.14A, and once it into linux, the current is about 0.15A, when wifi prepare to start, the current rise to 0.25A~0.30A(note, the power mush stable or it will reboot at this point), then the current will stable at 0.18A~0.19A if you do not transfer much data through wifi.

2. input 5V, current keep 0.12A~0.14A, can not boot … there is high chance flash is damaged. flash current consume is about 0.03~0.05A average.

3. input 5V, current keep 0.06~0.12A, can not boot … this might be memory problem.

4. input 5V, current is about 0.01A ~ 0.05A, can not boot … this should be RT5350 problem, might be BGA part is not well connect to pad. This always happened if you iron temperature is too high and the weight of the chip will make some BGA balls drop from pads. This should be rare to happen, but from my test, almost every time I use high temperature iron will cause such problem.

5. input 5V, current > 0.5A, I think your power supply is short connected somewhere.

6. input 5V, current = 0A, of course, the power is not connected, or chip is totally destroyed.

VoCore: Solder or NOT?

The package of VoCore contains some female connectors, if solder that on the pin holes, you can plug wire into it, so make the VoCore pin holes life longer.
IMG_0168

But due to most of people do not have such skill to solder that 1.27mm connector: it request a fast/stable hand and a low temperature iron(better <= 200C). Wrong operation might damage the board permanently. VoCore is NOT similar like Arduino, it is much more complex and precise than Arduino, every move must be very careful, even harder than repair a phone. I suggest to boot your VoCore as my two tutorials: http://vonger.cn/?p=1547 http://vonger.cn/?p=1536 I have used that USB DIY wire a long time, it always works well, and will never damage VoCore. The pin hole is Au + Cu, like golden fingers, so it should not that easy be oxidised.

VoCore: No LuCI 2

Looks like goahead is not a good choice to replace LuCI.
It uses too much space(850KB), maybe memory cost is low, but flash cost is not acceptable.
Screen Shot 2014-11-09 at 9.48.35 pm (2)

Also it request librt.so and libpthread.so, that is about 100KB addition flash cost.
Screen Shot 2014-11-09 at 10.01.32 pm

I think maybe write a real light weight one is the only choice. We do not need that complex cgi function, we just need a way to transfer data between browser and the server.
Currently vocore.io/store, the trace page is based on a light weight C language web application(I am not good at php, so have to write one in C), it will not be very hard if we just have a simple cgi and do not use https.

VoCore: About Ship Time

Ship will take about 5~40 days. If it takes very long, I suggest to use DHL/UPS/Fedex.
Alpha, average ship time(about 100 packages):

Position         Average Time    Note
Australia 8 days (min 6, max 12)
Austria 10 days No official data.
Belgium 12 days
Brazil 40 days
Bulgaria 14 days
Canada 14 days
Czech Republic 14 days
Denmark 11 days
Finland 14 days
France 10 days
Germany 15 days
Greece 26 days
Hungary 20 days
Israel 22 days
Italy 20 days
Netherlands 10 days
New Zealand 8 days
Norway 17 days
Poland 14 days
Russian Federation 21 days
Spain 36 days
Sweden 30 days
Switzerland 12 days
Taiwan 14 days
Thailand 9 days
Turkey 16 days
United Kingdom 7 days
United States 7 days (min 4, max 14)
Japan 14 days
India 48 days (min 34, max 70)

To US,UK and Asia the speed is acceptable, 90% packages are delivered in one week; To Europe countries, the speed is fair, about two weeks for most of them, but Spain, Greece, Sweden takes very long time… Even worse, to Brazil, it takes over a month, due to there is no air plane from China.ShenZhen to Brazil. Better to use DHL/UPS/Fedex if you want it get you fast.

VoCore: Simple Start Tutorial 2

Prepare:
1. USB wire 
2. VoCore
IMG_0136

Step 1:
Cut the USB wire in the middle. We use red and black wires.
IMG_0137

Clean up the USB wire.(not necessary).Tape again. :)
IMG_0142

Step 2:
Connect VoCore to the wire, and connect USB to computer.
IMG_0165

Now it works, then you can find VoCore in your computer AP list.
Rest please read http://vonger.cn/?p=1536.

Note:
1. Some computers USB power supply is not stable, that might cause VoCore failed to reboot. MacBook, ThinkPad do not have such issue. From report, some Dell PC might have such issue.
2. Clean up is not necessary, but better to do if you want to use your USB wire in long term. :)

VoCore: Simple Start Tutorial 1

Prepare:
IMG_0132

1. VoCore
2. 18650 battery(Li)
3. Two wires

18650 battery voltage should be higher than 3.60V.
IMG_0116

Step 1:
Connect the wire to VoCore.
IMG_0133

Step 2:
Connect the wire to battery
IMG_0134

Step 3:
It works
IMG_0135

Step 4:
Wait about 30 second, you will find VoCore in your wifi AP list.
Connect to it.
Screen Shot 2014-11-06 at 10.38.33 pm

Step 5:
ssh root@192.168.61.1, password: vocore
Now you are ready to use it.
Screen Shot 2014-11-06 at 10.39.06 pm


Note:
1. VoCore need a very stable input power, or it will fail to boot. (I found when the wifi start up, the momentary current is high, about 350mA~400mA, so if the input power do not have such ability to supply, it will reboot)
2. I use tape to make GND touch the battery negative pole, that is not a good idea, just temp solution, better to use a battery holder, and solder wire to it, to make sure it is well connected.

VoCore: Mountain of Packages, moved

This should be the final step of the indiegogo campaign. Just record what is happening from last week.
Not that smoothly as always. πŸ™‚

1. Post office package the packages takes 3 days
I thought that should be all of the shipment, so I make an update on indiegogo.
Just put them into bags, and put the connectors with the items together.

2. Post office tag the packages takes 3 days
We have the trace id, but in fact, the package still in post office.
Every package be weighed, also check the address, pick out the one have special characters.

3. Post office input the trace id into their system takes 2 days.
Finally I get the trace information, the package are shipped.
I have checked some of the package, all have information already, so I just make another update yesterday, that is the trouble comes πŸ™‚ I get tons of email about the trace id still no information(The post office still not make all the package information online) and someone complains vocore.io/store need password to login, also some warm heart emails, really appreciate for that, I can not reply one by one but I have read them all.

Ye, after that, I remember I am sending email to thousands of people…I do not dare to use that update anymore πŸ™‚

(Email should input into the red box, some browsers might not compatible, due to this part I write by C++ for faster speed)
Screen Shot 2014-11-06 at 8.12.32 am

At least VoCore are shipped almost in time(how stupid I am, I thought I can ship them earlier, this is true: it is always hard to do than think)
I also take a look on other indiegogo campaign, do not how much stress they are taking, some of them delayed almost a year…