This week I had the pleasure of participating in the Intel IoT Roadshow Seattle. I helped build a prototype backup camera for a car. We placed 3rd and I'm now addicted to hackathons. These instructions will let you reproduce our process. I relied heavily on two guides to do this. Rather than reproduce the original work in those guides, I will focus on adding depth and solutions to some of the issues I encountered.
This will be Part 1 of a series. Part 2 will cover combining the camera with an accelerometer. Part 3 will cover getting all of this to work with a simple android app.
Tools and Toys
- Intel Edison board (with power cable and two micro-USB cables)
- UVC-compliant USB webcam
- RC Car (optional - for testing)
Set up your Edison
Intel has a great guide in the official documentation. I was completely new to the maker space (no Arduinos or Raspberry Pis or anything for me) and I was able to follow this guide to set up a brand new board http://www.intel.com/support/edison/sb/CS-035344....
Set up the webcam
Edi-cam does all the work of converting the video feed to something that can be accessed via a web browserAlso includes a beautifully written setup guide: http://www.intel.com/support/edison/sb/CS-035344....
Step 1: Troubleshooting the Setup Steps
If you're like me, you tried following those two guides but you encountered some difficulties. I'm going to cover some of the issues I found while going through the setup of the Edison and the webcam.
Screen refuses to connect - Resource busy error [OS X users only]
The Intel guide tells Mac users to use screen, like so (you will have something different from A402YSYU):
screen /dev/tty.usbserial-A402YSYU 115200 -L
Often this would stop working because screen doesn't seem to quit gracefully. I was able to fix it with the following
ps kill <# of the screen process>
Getting ssh to work
I want to cover this specifically because I do all dev work in OS X whenever possible and where windows users get PuTTy, I was told to use screen. It only took a few hours for me to realize I needed something better and for me that was connecting directly to the board through ssh.
How it should work: Connect easily to the board with root@<The Edison IP address>
MacBook-Pro:~ verduranti$ ssh firstname.lastname@example.org
Issue #1: SSH doesn't work with no password
Solution: Set up a password for root using 'passwd'. There's a way to make ssh work with no password, but this solution has the added benefit of restricting access to the Edison when you open it up as a hotspot.
Issue #2: SSH gives error about not being able to find the hostname.
Solution: There's an issue with the configuration. For reasons I am still exploring, the following seems to generally work, even if you have to use screen to get into the device. This solution is not permanent and sometimes has to be re-entered.
ifconfig usb0 down
ifconfig wlan0 down ifconfig wlan0 up
Issue #3: NodeJS server (part of Edi-Cam) blocks SSH access
Solution: SSH into the board before starting up the NodeJS server
You have never used vi
Issue #1: What is this? None of the keys work right?! Sound familar?
Solution: You have stuff to do! Today is not the day to learn vi! Just install nano on the Edison and save yourself the tears.
opkg install nano
Step 2: Make Your Edison Hotspot
The official description for this is "Enabling Access Point Mode"
All you have to do is press and hold the power button for more than 4 seconds but less than 7 seconds.
The board's green LED will begin to blink.
Also, you can now point your computer's (or phone's or anything's) wifi at the new hotpot. The same will be the same as the name you gave the Edison in the configure_edison --setup step and the password will be the same one you use to ssh in (or nothing if you haven't bothered to set one).
I know it feels like you should have internet but unless you have done something not covered in this guide you will now have no internet. But you will be able to access your Edison via its ip address. (In theory http:// name>.local should work too but I had trouble with that syntax)
If you ssh into the board ifconfig will tell you the ip address.
Step 3: Assemble Backup Camera
If you've gotten this far, you have a working Edison and a working webcam feed so now you just need to put the pieces together.
You can use the hotspot to SSH into the board so you don't need the serial port connection.
You can connect a 9 volt battery to power the board and the camera. This is awesome for demos however this set up will DEVOUR batteries. A fresh 9 volt Duracell lasted less than an hour. Possibly less than 30 minutes. To maximize the life of the replacement battery (without having to reboot the Edison and camera feed) we became quite good at swapping power supplies.
Powered by battery, camera feed working, hotspot working, USB switch flipped towards the USB port.
To use USB power:
Connect the USB/micro-USB cable to the middle Micro-USB port on the board. Connect the USB end to a power ed port such as a laptop.
Flip the switch to the micro-USB side. This will cause an error in the video feed stream convertor, but you can safely ignore the error.
When you want to demo a fully wireless solution:
Flip the switch back. The camera feed will resume, you can unplug the USB cable and your battery's short and glorious life will begin.
If at any point the board's blinking green light goes out - something went wrong and now you need to reboot the board and restart the video feed conversion script and NodeJS server.
Hook up your RC car!
Why you might ask? Because this is a back camera, of course! Mount this baby on the back of an RC car and kick that baby into reverse. You'll gain a whole new perspective. Or mount it to the front: congratulations, you've made your own GoPro. :)