Monthly Archives: December 2014

VoCore + Sound

VoCore has its eye by using MJPEG camera , recently I am trying to add ear&mouth to it.

The following points are keys for make this happen:
1. codec.
for internet voice chat, my choice is G711
for local network, pure PCM, do not compress

2. sample quality.
G711 only support 8KHz, 16bits.
PCM 48KHz, 32bits for local network.

3. DAC chip.
WM8988 or other many choices.

Sample for voice, 8KHz is enough. Default PCM 8KHz is 16bits, so my choice is 8KHz. (this is the lowest quality, so if this way works, we can improve it later if there still exists free bandwidth)

For codec part, my target is to encode/decode same time.
I spend a lot time test some codec:

skype silk quality is best, but on vocore, the speed is too slow, 10 second wav file encode speed is only 0.3x. Far from online chat request. Decode might be better, but still not enough 0.8x. (Of course, CPU usage is over 90%, btw, this is the reason I write vohttpd πŸ˜€ LuCI can not open at all, but vohttpd works very well) Opus is not a good way.
(If you want do this test, it is very easy under openwrt, just install the opus library and opus tools)

Let’s choose old fashion way. πŸ™‚ I do not want waste much cpu on this, so G711 is the best choice, it only compress 16bits -> 8bits, so 8KB/s is enough for voice transfer.

Of course, if you are rich and have google fiber at home and 4G outside, that is another story πŸ™‚ We do not need to compress and send voice sample by 44.1KHz 32bits πŸ™‚ only take 176KB/s. This is CD quality, lol.

Somebody has already done that, use RT5350 and WM8988 to make a wifi audio, WWAN speed is far enough for transfer 48KHz, 32bits audio. Easy to make it support Airplay and some other wifi audio protocol.

Now, I am trying to make a DIY wifi audio… πŸ™‚

Happy New Year πŸ™‚
ζ¬’εΊ¦ε…ƒζ—¦ο½ž

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.