VoCore: I2C / AD Convert

It is time to write something 🙂
My choice is I2C on VoCore, due to it is necessary for AD convert chip, my board main chip is PCF8591T.
In VoCore forum, somebody have tried that already, happens to use the same chip, that really helps a lot.
Here is the link:
http://forum.vocore.io/viewtopic.php?f=10&t=115

This is my PFC8591T test board:
main

Directly connect to VoCore:

BOARD VCC -> VoCore 3.3V
BOARD GND -> VoCore GND
BOARD SCL -> VoCore G#02/I2C_SCLK
BOARD SDA -> VoCore G#01/I2C_SD

Note: Please download the latest manual, old one have bug about i2c pins. http://vonger.cn/upload/vocore.manual.pdf

My connection:
IMG_20150414_234850

Important Note: I2C should have pull up resistors on SCL and SDA, but for simple, I did not use it, my current PFC8591T just works well, but it is not guaranteed, in other case, MUST connect with pull-up resistors.

ssh to VoCore, check if /dev/i2c-0 exists.
If not, check if you have installed all i2c model(call lsmod | grep i2c)
kmod_i2c_core, kmod_i2c_dev and kmod_i2c_ralink

If there still no /dev/i2c-0. call insmod i2c-dev
(Still not there? Try to compile and upload firmware again, might be driver version issue, old driver might not work)

Option: we can install i2c-tools to test i2c.
Current openwrt package, it has been removed.
We can find it in old packages for 14.07.

http://downloads.openwrt.org/barrier_breaker/14.07/ramips/rt305x/packages/oldpackages/libi2c_2013-12-15-1_ramips_24kec.ipk
http://downloads.openwrt.org/barrier_breaker/14.07/ramips/rt305x/packages/oldpackages/i2c-tools_2013-12-15-1_ramips_24kec.ipk

Call i2cdetect -r 0
You will get this:

root@OpenWrt:~# i2cdetect -r 0
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0 using receive byte commands.
I will probe address range 0x03-0x77.
Continue? [Y/n] 
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                    

That 48 is HEX, it is equal 1001000b, that is PCF8591T address code, so this device is normal.

Let’s try more. 🙂 The code on forum just works, compile it and transfer it to VoCore.(Looks like we are using same board too, so I do not need to change a line 😀 )

root@OpenWrt:/tmp# ./pcf8591
Light:245 Temp:216 X:148 Potmeter:120

My compiled app: pcf8591

VoCore: RC servo

Thanks to Ton Augustin(ton/at/augustin.com) provide this driver. 🙂
I do not have such device, so I did not do a full test. Hopefully this will help if you are using VoCore do similar project.

Source code/Usage/Firmware Download:
Download

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.

 
Run it at startup.

root@OpenWrt:~# cat /etc/rc.local
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

/bin/sh /root/fix_sta_ap.sh > /dev/null &

exit 0

 

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 😀

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.