Welcome

This blog details my finding in building and setting up a small web connected humanoid robot.
The first objective of this project is to fully control and monitor the robot from internet.
This will be done by adding a single board computer running a full Linux system connected to the Robovie Nano robot by the serial port and connected to the web by wifi.
Beside web remote control, I will take advantage of the complete Linux system to add some higher functions to this robot (environment analysis, navigation, speech & video recognition,...).

There are several constraints in this project.

At first a limited weight and space . The Nano is a very small robot and the available space is quite narrow (6 x 3 x 2 cm in the back) .
The added weight load must be under 100 gms (Linux board + battery + wlan+ audio + webcam + sensors ) if we want to keep fluid motions and good autonomy.
Due to theses constraints I have to work with a minimal processing power. I am using a Bifferboard from Bifferos running a full Debian Distro at 150Mhz.

The tasks and progress are:

Build Debian kernel & rootf : (done) Debian Squeeze with headers. Linux 2.6.32.2
Wlan (done)
Remote motions control (done)
Remote master slave control : (done)
Video streaming - 2 ways : (done)
Vision/Blob recognitions (not started)
Sound streaming - 2 ways (wip) - can play stream, can record sound
Speech Synthesis (done) - flite working well, espeak is choppy but still usable
Speech Recognition (wip)
Remote Sensors monitoring (done) Battery level, accelerometer, distance, temperature
Lcd usb display (done) - hacked 1.5" key chain
Oled i2c display (wip)
Auto charging (not started)

Friday, July 1, 2011

BOA WEB SERVER

apt-get install boa
http://www.boa.org/documentation/boa.html#toc3

Start with: boa

CGI SCRIPTS IN:  /usr/lib/cgi-bin/scripts

To modify in /etc/boa.conf
# User: The name or UID the server should run as.
# Group: The group name or GID the server should run as.
User root
#Group root

Friday, March 18, 2011

USB LCD & BIFFERBOARD

I hacked a  cheap 1.5” color USB LCD (Copy DP-152, you can find some as low at 5 usd on Ebay)  following http://picframe.spritesserver.nl/wiki/index.php/Main_Page
Without the body and Lipo, the screen is less than 10 g, and very compact. I could save 1-2 g and 2 mm in thickness by removing the mini  usb.









I also removed the screen buttons, they are not necessary as it start automatically in USB update mode.
The driver is  easy to compile, as long as you have installed the libgd2 library.

I can display any picture with the command. /septic /dev/sdb /pic.png.
The little script provided by Spritesmods to display a webcam stream allow me to either to display the stream from the onboard camera or from any ip camera (mjpeg stream) .

The frame rate is slow, ~1f/s, as the script is basically graping a jpeg and converting to a .png (with Imagemagik) , which is quite heavy work for the Biff..

It took me more time to compile lcd4linux (ton of dependency pbs), but it is a neat application thanks to I can display the processor speed, ram left, wifi traffic, system message, batteries status…

http://lcd4linux.bulix.org/
I can simultaneously run lcd4linux and the webcam script but I will have to fine tune the font color,& size to make everything more readable with a changing background.




Here is my lcd4linux.conf file:



variables {
wifi 'wlan0'
dysk '/tmp'
transparent
minuta 6000
0 'ffffff00' }
{ Driver
Display st2205u
'st2205'
'/dev/sdb' Font
Port
'6x8'
d 'ffffff' Backgrou
Foregrou
nnd '000000' Basecolor '000000'
t
} Plugin FIFO { FifoPath '
/mp/lcd4linux.fifo' FifoBufSize 80
} Widget CPU_Busy { class 'Text
' expression proc_stat::cpu('busy', 500)
prefix 'CPU ' postfix '% '
ign 'L'
width 10 precision 1 a
lupdate minuta } Widget RAM {
meminfo('MemFree
class 'Text' expressio
n') prefix 'RAM ' postfix 'Kb'
'R' upd
width 11 precision 0 alig
nate minuta } Widget IPaddress {
info::ipaddr(wifi
class 'Text' expression ne
t) prefix 'IP' width 20 align 'C'
reground '00ff
style bold Background transparent F
o00' } Widget wlan_qual { class 'Text'
) prefix 'WLAN QUALITY: ' width 20 al
expression exec('cat /tmp/wlanvar.tmp', 300
0ign 'C' update 3000 } Widget down_icon { class 'Icon' speed 500 Bitmap {
.|*****|.***.|.***.' Row3 '.***.|.....|.....|..*
Row1 '.....|..*..|.***.|*****|.***.|.***.|.***.' Row2 '.....|.....|..*..|.**
*..|.***.|*****|.***.' Row4 '.***.|.***.|.....|.....|..*..|.***.|*****' Row5 '.***.|.***.|.***.|.....|.....|..*..|.***.'
*.|*****|.***.|.***.|.***.|.....' } Background t
Row6 '*****|.***.|.***.|.***.|.....|.....|..*..' Row7 '.***.|*****|.***.|.***.|.***.|.....|.....' Row8 '..*..|.*
*ransparent Foreground '00ff00' } Widget up_icon { class 'Icon' speed 500 Bitmap { Row8 '.....|..*..|.***.|*****|.***.|.***.|.***.'
.***.|*****' Row4 '.***.|.***.|.***.|.....|.....
Row7 '.....|.....|..*..|.***.|*****|.***.|.***.' Row6 '.***.|.....|.....|..*..|.***.|*****|.***.' Row5 '.***.|.***.|.....|.....|..*..
||..*..|.***.' Row3 '*****|.***.|.***.|.***.|.....|.....|..*..' Row2 '.***.|*****|.***.|.***.|.***.|.....|.....' Row1 '..*..|.***.|*****|.***.|.***.|.***.|.....' }
ign 'R' Foreground 'ff
Background transparent Foreground 'ff0000' } Widget wan_dl { class 'Text' expression (netdev(wifi, 'Rx_bytes', 500))/1024 postfix 'kB/s' width 8 precision 0 a
lffff' Background transparent } Widget wan_up { class 'Text' expression (netdev(wifi, 'Tx_bytes', 500))/1024 postfix 'kB/s' width 8 precision 0 align 'R' Foreground 'ffffff'
ff' Background '000000
Background transparent } Widget wan_bar { class 'Bar' expression netdev(wifi, 'Rx_bytes', 500) expression2 netdev(wifi, 'Tx_bytes', 500) length 21 direction 'E' Foreground 'fff
f80' BarColor0 '008000' BarColor1 '800000' } Widget tail_log2 { class 'Text' expression exec('tail -c -35 /var/log/messages', 1000) width 20 align 'M' update 500 } Widget fifo {
03.Col01 'IPaddr
class 'Text' expression fifo::read() width 20 align 'M' update 400 Background 'FFD700' Foreground '0000FF' } Layout mylayout { Row01.Col01 'CPU_Busy' Row01.Col11 'RAM' Ro
wess' Row04.Col01 'wlan_qual' Row07.Col01 'down_icon' Row07.Col02 'wan_dl' Row07.Col11 'up_icon' Row07.Col12 'wan_up' Row08.Col01 'wan_bar' Row14.Col01 'tail_log2' Row15.Col01 'fifo' }
Display 'st2205u'
Layout 'mylayout'



USB HUB & BIFFERBOARD

It seems that only the USB Hub pictured below contain a special chinese chip (some fe1.1 type ) that allow webcam streaming in full resolution with Linux.



With this hub , Mjpgstreamer and uvcstreamer work well in MJPEG (10 fps at 640x480 with my cheap and extra small webcam).
With other hubs, I have lower performances and can only stream in YUV.
For space reason I am going to replace this hub with  a common USB 2.0 hub, with a smaller pcb size 3 x 2 cm. I will still be able to stream in YUV at 5 fps which is enough for me now.

Saturday, February 26, 2011

SPEECH & MUSIC

A USB sound adapter with the chipset CM119 give much better result than the cheap one I firstly used (with chipset 6911).
I can now play sound (small .mp3, .wav or text to speech with Flite) simultaneously with the webcam streaming and doesn’t experience anymore sound quality issues.

It  can also play web streaming radio with the command:
wget -O - http:/ip address :port number | madplay - -m -o wave:- | aplay



The "Music Fairy" pictured has the smallest pcb. I added 2 x 0.25 W speakers in the Nano hands.

WLAN

I am using a very small wlan USB adapter with the module rtl8192CU compiled from  rtl8192CU_linux_v2.0.939.20100726 (you need to have the Linux header to compile it).
This module was posting quite a lot of messages to the console (issue nulldata to keep alive and issue_nulldata:0) , it can be annoying, I commented out these 2 lines to remove them:



In core folder / rtl871x_mlme_ext.c I commented ligne 2790:
DBG_871X("issue nulldata to keep alive\n");
and line 1507:
DBG_871X("%s:%d\n", __FUNCTION__, power_mode);


Here is my network configuration ( /etc/network/interfaces)


# The loopback network interface - always needed here
auto lo
iface lo inet loopback

# this one for dhcp
#auto eth0
#iface eth0 inet dhcp

# this one for  WIFI
allow-hotplug wlan2
iface wlan2 inet static
pre-up ifconfig wlan2 up
pre-up iwconfig wlan2 mode Managed
pre-up iwconfig wlan2 essid "linksys-G-MIX"

# The primary network interface - use this for cable if WIFI above not used
# in that case disable the WIFI above with # before each line
#allow-hotplug eth0
#iface eth0 inet static

# set these for the LAN address
address 192.168.11.16
netmask 255.255.255.0
network 192.168.11.0
broadcast 192.168.11.255

# set this for the Internet modem gateway to the LAN
gateway 192.168.11.1
# dns-* options are implemented by the resolvconf package, if installed

# my gateway acts as a local dns-nameserver
dns-nameservers 192.168.11.230
dns-search example.org

Pictures & Videos






video
video
video

Monday, February 14, 2011

BIFFERBOARD

This is a fantastic little board, affordable (35 pounds) , very light and compact. it has only 150Mhz processor but it is the price to pay for a minimum  power consumption size and cheap price.

Here are the specifications.

150MHz CPU, Intel 486SX instruction set, MMU.
1 watt power consumption (200mA @5v)
68mm x 28mm x 21mm (weight 28g)
32MB SDRAM/8MB Flash
OHCI/EHCI USB 2.0
10/100 ethernet
Serial console 115200 baud (can be used as 2 GPIO)
4-pin JTAG (can be used as GPIO)
2 permanent GPIO (1 LED, 1 button)

To buy it: http://bifferos.bizhat.com/
Wiki: http://sites.google.com/site/bifferboard/
Group: http://groups.google.com/group/bifferboard



It tooks me a lot of time to build the Debian Distro with the header and all the features and tuning I wanted.
I am now running Debian Squeeze on a Linux 2.6.32.2 kernel.
Basically all the modules are enabled and a wide range of USB devices are  recognised and will work out of the box (bluetooth dongle, Serial ftdi, several Webcams, wifi adapters, USB audio,....).
I used Stuart Hopkins' Debian kernel/rootfs build and installation scripts :

http://www.linux-depot.com/?p=projects&s=bifferboard


(note 1: the .debs links are broken in the rootfs scripts, so you need to compile your own .debs and update the script links)
(note 2: for the 2.6.32.2 kernel build you need to add the relevant config files and patches, you can download them from the Bifferboard repository)

I also collected many good infos from Graham blog below:

http://www.sunspot.co.uk/Projects/Bifferboard/biff_index.html


You can download my Kernel image and Debian rootfs with the header from the links below:

https://docs.google.com/leaf?id=0B6rYc4n12uHTMGViYTcyOGItMDkyZi00YTdiLTljNTEtMjBjMWU3YTNhZDAy&hl=en_US


To install :


Untar the files (all the files are compressed in one folder)

1- flash the kernel.
python bb_upload8.py /dev/ttyUSB0  image_name


2- format your usb disk
mkfs.ext3 /dev/sdx1 (change x with the letter of your usb disk)
tune2fs -c 0 -i 0  /dev/sdx1


3-copy the rootfs folder content to the usb disk


Login = root, Password = root

Notes:

STARTUP SCRIPT:

I added a startup script (clovis_startup.sh) in /etc/init.d (to start the gpio, I2c, wlan,..)
If you modifiy it then type the following at a console line:
update-rc.d -f  clovis_startup.sh remove
update-rc.d -f clovis_startup.sh defaults



BOOT TIME:
between 40s and 1min 20 (depending if you leave or note Lighttpd, i2c, gpio, alsa...)


BUTTON GPIO  to reset WLAN (2 s) or Poweroff (5 s)
Script to add in /etc/rc.local as:    /home/gpio/button2.sh &
(start it with ./rc.local once)
#!/bin/sh
#button2.sh
#Script to add in /etc/rc.local as:    /home/gpio/button2.sh &
#(start it with ./rc.local once)
echo 15 > /sys/class/gpio/unexport #flikker the red led 2 times
echo 15 > /sys/class/gpio/export
echo 16 > /sys/class/gpio/unexport
echo 16 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio16/direction
echo 1 > /sys/class/gpio/gpio16/value
while : ; do
BUTTON1=`cat /sys/class/gpio/gpio15/value`
if [ "$BUTTON1" = "0" ]; then
   sleep 3
BUTTON2=`cat /sys/class/gpio/gpio15/value`
   if [ "$BUTTON2" = "1" ]; then
echo !!WLAN REBOOT!! > /tmp/lcd4linux.fifo #print !!WLAN REBOOT!! on the lcd screen
echo 0 > /sys/class/gpio/gpio16/value
sleep 1
echo 1 > /sys/class/gpio/gpio16/value

/sbin/ifdown wlan2
/sbin/ifup wlan2

echo wlan rebooted > /tmp/lcd4linux.fifo #print "wlan rebooted" on the lcd screen

   else
echo !!POWEROFF!! > /tmp/lcd4linux.fifo
echo 1 > /sys/class/gpio/gpio16/value
/sbin/poweroff
   fi
fi
sleep 1
done
exit 0