Introduction: How to Set Up a HD Webcam on Bifferboard Running Debian

Picture of How to Set Up a HD Webcam on Bifferboard Running Debian

In 2010 Bifferboard was the smallest size Debian board. It's hardware was the same as for a NAS server. But it was NOT possible to re-program NAS server to make a Bifferboard. Needed to order from company.

Processor speed was only 150 MHz. RAM 32MB, small too. Power consumption from wallplug with a webcam, hub and USB stick was 4.5 W.

You can set up a HD webcam using mjpg-streamer using Logitech C510 or C270. Some example pictures are here:

http://asi.lv/alnis/

Motion detector attached to GPIO with an endless loop in a sh script was not reliable. Looks like there was not enough RAM or there was a Debian bug: when many sh scripts run simultaneously they dissapeared from "ps -ef" list. Sometimes it happened after just 10s and sometimes after 7 minutes. Swap file did not help. Might be RAM defect.
Wi-Fi stick worked, but only for some minutes. Same issue.

If size is not an issue then in future projects requiring low power consumption would recommend to use OpenWRT router Wr703N.

Be prepared that Linux programming is not easy. Sometimes you need to Google for hours for a single line of code.
Below are my programming notes that could hopefully help you to set up Bifferboard faster. Sorry that they are somewhat messy. Hope thee notes can be useful to you when programming other Linux boards.

Comments

vturkovic (author)2012-01-23

Hi,
I saw some of your articles and they are all awesome! We have some similar interests so I would like to share one gem of a device I discovered.

It is small TP-LINK WR703N router: http://dev.wlan-si.net/wiki/Routers/TP-LINK/WR703N

You can get it for 25$ and it uses only 0.5W of power. It has 400 Mhz Atheros chip and 32MB of RAM.

And it is tiiiiny ;)

Cheers,
Valent.

bifferos (author)2011-09-29

Did you run your shell script on another system to test it there? We spent a long time debugging a problem on one Bifferboard, we thought it was a reliability issue, however it turned out there was a bug in the shell script causing it to consume all the memory. it was very subtle. It's easy to do this kind of thing in Shell. If you configure some swap for the debian system it might run for longer, maybe that will tell you what the problem is.

The power consumption listed on the site is for the board only, using only the on-board flash. Obviously we cannot guess what you are going to plug into it , so that's why the difference between 4.7W and 1W. It also applies to the board itself and doesn't take into account the PSU efficiency.

Please note that all Software development is now in Git with kernel 2.6.37.6
https://github.com/bifferos/bb
If you want to play with OpenWrt it's best to look there. There is also an emulator, so maybe you can try to get your project working in the emulator first.

The Famzah site is still the best place for Debian hints.

thanks,
Biff.

janisalnis (author)bifferos2011-09-29

Hello Biff!

It is so cool to get comments from Bifferboard creators practically immediately.
I had nice time playing with Bifferboard and it is the board with which could get webcam running with HD resolution while with FoxboardG20 and NanosG20 were problems with HD resolution.

The shell script with infinite loop runs fine and does not crash when it is executed manually. But if it is executed by a crontab it just dissapears after some time from ps list.

Shell script is in file 08 GPIO motion detector input.txt. May be you have time to look at it. (The ftp password is changed.) I can not access Bifferboard now as it is taking pictures in Latvia behind a firewall while I am in Germany. I will go there in two weeks and it will be interesting for me to solve the problem and get motion detector running.

bifferos (author)janisalnis2011-09-29

:)

When things don't run under crontab it's usually about paths - maybe you can check to see what environment variables are set when the program launches from crontab (cat them into a file or something), and compare with running directly, e.g. add something like:

set > /tmp/my_paths

To the start of the script.

janisalnis (author)bifferos2011-10-21

Recently I played with bifferboard again. Did not solve the problem with ps jobs dissapearing. One possible explanation would be that there is some RAM defect.

bifferos (author)janisalnis2011-10-22

Many people blame the ram, and then find out it's their program, or sometimes the power supply. In the two years we've been selling these we've never found one with faulty RAM. Failures in the field so far have been the serial console, ethernet and sometimes flash memory, but never DRAM. Failures are still pretty rare, 1 in 3-400 units.

One of the problems with running Debian/Slackware instead of OpenWrt on these devices is that those distributions use more RAM. If you don't have swap configured sometimes things don't fail gracefully when you run out of memory. I think you'll find the problem is more about running Linux in 32MB RAM, rather than the Bifferboard itself. This is what I found when running Slackware.

To test things out, I recommend you install VirtualBox. Use it to emulate a system with 32MB of ram, run your application under Debian and just see what happens. VirtualBox gives good USB support, so your webcam should work. When you have everything working in that environment we can look to see what might be different to the Bifferboard system. This is how I prepared the Slackware rootfs on Sourceforge because installing using the Bifferboard would have taken forever, and I had to make some tweaks to Slackware to make it work nicely in 32MB (avoiding use of tmpfs in some places).

Obviously I don't have your webcam, but if you can give me a firmware to try out which doesn't depend on that I can try it on one of my boards. You can also run memtest on your board, there are some instructions here:
http://sites.google.com/site/bifferboard/Home/bootloader/memtest86

cheers,
Biff.

janisalnis (author)bifferos2011-10-22

Hello Bifferos,

thank you for teaching me how to troubleshoot.
It is impressing that you have sold so many boards. Is robotics the main application.


In summer, using OpenWRT that came with the Bifferboard I could not get webcam running because webcam modules were missing. I tried to compile OpenWRT myself by selecting webcam modules, but after a half day spent, the compilation did not run and I gave up.


I am now in Riga and with students placed Bifferboard at the physics institute in the old town.
Logitech C270 webcam is facing a pub.
Nice thing is that Bifferboard IP is accessible from outside.
http://85.254.232.139/

If you have some time, may be you could have a look at it through SSH

ssh root@85.254.232.139
password is the first letter of alphabeth


cd /var/www

file containing endless loop is
aiziet.sh

file init.sh is executed by crontab every minute
it checks if aiziet.sh is running.

Every time when init.sh restarts aiziet.sh it adds a line with a date to a file test_init_started
I clearly see a patern of restarting needed every 8 min. But sometimes every minute.

Power supply should not cause a periodic 8 min behaviour. Like you say, it must be something in Linux. There is a swap, but RAM is almost full.


If ./aiziet.sh is run from a console it does not crash.

mjpg-streamer process does not crash.


Today I tried rrdtool database that puts additional load on the RAM. Comparing with other Linux boards it took forewer to generate a png picture, and if I put it in crontab then no pictures were generated meaning that it crashed. So I gave up and uninstalled rrdtool. There is a simple solution to send temperature value to some other Linux machine that generates a plot.

It is interesting to explore different boards and every board has its own surprises and one has to live with them.

Greetings,
Janis

bifferos (author)janisalnis2011-10-23

"In summer, using OpenWRT that came with the Bifferboard I could not get webcam running because webcam modules were missing. I tried to compile OpenWRT myself by selecting webcam modules, but after a half day spent, the compilation did not run and I gave up."

About OpenWrt compilation. I've just uploaded a new firmware based on kernel 2.6.37.6 with 2017 packages, maybe the ones you need are there? Feel free to try it out.

Check the announcement for the firmware location: http://groups.google.com/group/bifferboard/browse_thread/thread/1c58e0d2f7788ae2

Maybe in the future I will ship the Bifferboards with this firmware.

bifferos (author)janisalnis2011-10-22

I only noticed the USB errors:

Adding 131064k swap on /swapfile. Priority:-2 extents:36 across:417880k
ehci_hcd 0000:00:0a.1: dma_pool_free buffer-32, c07a0000/7a0000 (bad dma)
ehci_hcd 0000:00:0a.1: dma_pool_free buffer-32, c07c0000/7c0000 (bad dma)
ehci_hcd 0000:00:0a.1: dma_pool_free buffer-32, c1420000/1420000 (bad dma)
ehci_hcd 0000:00:0a.1: dma_pool_free buffer-32, c1400000/1400000 (bad dma)
ehci_hcd 0000:00:0a.1: dma_pool_free buffer-32, c07e0000/7e0000 (bad dma)

If swap is on an unreliable partition, then that will cause big problems for Linux.

Apache is not going to be the best http server to be running because it's using almost all the Bifferboard memory. I would suggest moving to something a little lighter weight instead.

I can't see anything obviously wrong with your scripts, but you seem to have a cron job that runs forever, so I don't know if that causes cron problems.

About This Instructable

5,237views

8favorites

License:

Bio: I am a researcher working on development of optical atomic clocks. Electronics is my hobby since childhood when my uncle was bringing me old phones ... More »
More by janisalnis:Miniature HHO Electrolyser Torch for Work on Jewelry  and Quartz Optical FibersArduino Webservers Ethernet ENC28J60 with thermometer DS18B20, I2C LCD and Power Over Ethernet POE  for ZABBIX IOT data loggingMini-spectrometer From a DVD and Folded Paper
Add instructable to: