VoCore: AP+STA Switch

This blog is used to solve the problem: when we setup AP+STA mode but STA can not connect to host, it will cause AP fails to show itself.

The Reason:
AP+STA, its real name is Bridge Mode, it uses half bandwidth connect to AP and another half to STA. So AP/STA must in same channel. If the driver can not find STA host, it will not get the channel for AP, so AP in VoCore can not show.

Solution:
First, scan STA connection state, if it fails to connect to STA, then force VoCore into AP mode. The benefit is obviously: we do not have to use TTL/ethernet to setup the config anymore, users are able to use wifi to update the configuration now.

The Script:
This script is from Zhuohuan Lee. It uses ubus to scan the STA state every 2~3 seconds. If STA fail, it will turn VoCore to AP mode. A nice script. :)

Download Here: fix_sta_ap.sh

PS: My idea is a script only run once after boot up, if STA do not work, make VoCore to AP mode, so we do not have to check every seconds.

VoCam264: Now It WORKS :)

VoCam264 is only 12.5mm x 12.5mm x ?? standard USB h264 720p HD camera. Now it works!

春节快乐!It is Chinese New Year recently, I did not get a chance update this blog :D

Finally make the first version work normal.

Here is the ugly one :) Thanks to my jump-wire skill learned from developing VoCore.

IMG_0373

 

The little one is a hot nuke when I connect it to USB, h264 encode is always hot. So release version will have a heat sink by default. I connect 12mm x 12mm x 3mm heat sink, works well, lower its temperature to about 42C, peace to use it.

Screen Shot 2015-02-23 at 22.46.39

 

I think this little heat sink is also good for VoCore RT5350, not cost much, about 5~8 cent.

I can not get its power consume due to if I did not connect USB D+/D-, it will go to standby mode by default, standby mode power consume should be lower than 5mA/5V.(it is 0.00A on my amperemeter) From its temperature, I guess its power consume is about 100mA ~ 150mA(0.6watt) when full speed working.

Now I should find a good lens for it. The CMOS chip is OV9712, any idea about good lens for it?(please email me,at,vonger.cn)

VoCore: AirPort with USB Sound Card

IMG_0292

Important: DO NOT buy such USB sound card like mine, it can not work. From Jeremy, USB sound card with CM108 chip works normal.

Call make menuconfig, select
Kernel modules –> Sound Support –> kmod-sound-core, mod-usb-audio
Kernel modules –> USB Support –> kmod-usb-core, kmod-usb-ohci, kmod-usb2
Utilities –> alsa-utils
Multimedia –> shairport

First, to make it compile smoothly, we must install perl XML::Parser or openwrt will complain “checking for XML::Parser… configure: error: XML::Parser perl module is required for intltool”.

perl -MCPAN -e shell

this part, press return/enter until CPAN shows its command line.

But this XML::Parser library can not install on my MAC, it can not pass its test, so we have to call install without test, use “force install”.

In CPAN command line, call this command.

force install XML::Parser

Finally call make V=s.

Now if everything moves smoothly, you will get the system upgrade file, scp it to your VoCore or other openwrt device, call mtd -e firmware write xxxxxxx.bin to cover your old firmware.

Plugin the USB sound card, call shairport -a VoCoreAIR

My Mac find it successfully:
Screen Shot 2015-02-14 at 11.09.53

but unfortunately, my side get the following error, :(

ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
FATAL: Alsa initialization failed: unable to open pcm device: No such file or directory

Shutting down...

I think the sound card is not correctly supported…so the app can not find interface of the card.
(if the USB sound card works, it will light a red LED)
If you have any idea(I removed the register on this blog due to too much spam here :) ), please mail me/at/vonger.cn .

Special thanks to Alex Tsai provide the install instruction of shairport.

It is openwrt truck issue :) Once change to 14.07, everything works normal, Jeremy solution is perfect, works well.

http://www.hackster.io/nzlamb/vocore-airplay-server

MT7688

IMG_0250

About end of last month I get this MT7688 board from taobao.
Just have a try recently, result is here:

Good Parts:
1. Temperature is low, about 35C.
2. Better memory, 64MB.

Bad Parts:
1. Wifi signal is very weak, about 5m it drops to -90db. (I think that is antenna problem, clear zone is too small)
2. The chip provider said this chip cost three times more than RT5350.
3. OpenWrt do not have a good support yet, need more contributors, but all datasheet is not open.

Unknown Parts:
1. Power consume is unknown yet, I use 9V power, the average current >0.30A, maybe the LDO power consume is too much.

If I have more time, will do more test later.

VoCore: Wifi Mode Small Issue

I am trying to make openvpn run on VoCore, so I set VoCore to AP mode with WPA2.
Change&Add the following lines to /etc/config/wireless

config wifi-iface
	option device   radio0
	option network  lan
	option mode     ap
	option ssid     VoCore
	option encryption psk2
	option key	TestPassword

If just set the config and then call “wifi” but not “reboot” to restart wireless part, it has an issue that every 10~20 seconds, the network will disconnect automatically.

But after reboot, everything back to normal.
This does not happen when change AP mode to AP+STA mode.
This happens when change from AP mode to encrypt AP mode.

So I guess the driver might have conflict inside. If we do not have to reboot but just call wifi to reset current config, that will be the best.

New Project: Tiny H264 HD USB WebCam

:) This two weeks I am on a new challenge, I am not very happy with current exists HD h264 camera, so I decide to make one of my own.
MJPEG camera might easy to use, but it costs too much network resource. Only choice is usb + h264 camera, but current h264 camera is super big(40mm x 40mm) or super expansive(such as some famous camera on the quadcopter, even most of them are not h264).

My target is to make a super small(I will keep the size as a secret for now. :D), powerful(with high quality microphone), h264 HD USB webcam.

It is really hard to design…due to the digit and analog are very near each other.
I can use some tiny parts to make this come easy(my friend suggest DCDC XCL206A303AR-G which is made in Japan, its cost is really high, almost 1USD for each), but no challenge, no fun, so have to use my poor brain, design it from common parts in market :)

Anyway, the first version board has in factory now, good luck to myself. If everything goes smoothly, later days I will write an adapter app for it on VoCore.

Can you guess out its real size from this layout picture?
Screen Shot 2015-01-20 at 12.07.24

A simple adapter board for USON8 flash(just feel it looks good):
tool

VoCore: How about to make a small wireless audio player?

Just made a simple test on the wireless audio module :)
It is so easy to enhance VoCore to control a headphone.

Let me tell you how easy it is: just connect I2S to the DAC chip, then connect speaker to the DAC chip, that’s all!

So I have an idea…
How about make the world smallest wireless speaker?

I have a Nokia Play 360, not that portable…it use bluetooth to transfer data, that audio quality is not good enough(if you always hear pure CD quality music, you will know how bad the bluetooth speaker). So I have to take it with a wire everywhere.(in fact, I did not take it everywhere except from kitchen to bedroom)

If we make a little cube(mini play 360?), contains 2000mA battery(enough for play 6~8 hours!)… Emm, that might be very cool!

Surround Stereo…5.1, just use wireless connect all of them without a single wire. Maybe this is a solution? 5.1 = 6 x 44.1KHz, 16bits = 8.4Mbps, wireless is far enough for this.

:) But if we want the best audio quality, an audio profession is necessary, this must be a team work.

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 :D 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 :)
欢度元旦~