-
1Step 1
So I needed to set up the robot to be wireless, to have a camera and to drive 2 DC motors and 2 Servos wile reading the input from the sensors and camera, eeeeasy. Well for the wireless part I required the robot to move freely without Ethernet cables, the best way i found to do this is to make a WiFi hotspot in he Raspberry Pi itself. I'll leave links to how i setted up this and the next few thing in this project page. After that the computer can connect to the raspi with no effort and establish an SSH connection with the Pi, the bonus here is that the Pi always gets the same IP address so I didn't have to modify the script every time it runs. For the camera I first saw the example of the Raspi cam in the Mathworks page, but being honest in my country the Rapi cam costs as much as the devboard, so i opted for a webcam that i knew it was compatible. Now I needed to get the images from a cam not supported on the Matlab original functions, the work around here is to establish an IP Camera through the 8080 port in the Pi and reading the images with Matlabs Ip Cam support packages (I'm still trying to do this, right now i used the motion program but I have a 2 sec delay, now I'm leaning toward the mjpeg streamer but couldn't configure it quite nice yet). It's worth to mention that if you have a Raspi Camera this set up is very straight forward and doesn't requiere this much configuration.
As every blog on the internet points put, the Raspi doesn't handle quite well PWM. The response I always get in the forums is that the core frequency of the Raspi can fluctuate thus generating discrepancies in the PWM output signals. So i can't drive the wheels nor the servos with it. My solution, use Arduino. I made a simple communication standard between the to using matrices from Matlab sent over serial, addapting voltages with a two resistor voltage divider, so that thing was done. After a couple of hours I designed a Raspbery Hat that can hold the Arduino Pro Mini and regulate the voltage to 5v for both devices, using Eagle CAD. The board also has connections for all the pins of both devboards, an L293D as a DC Motor Driver, a Voltage Regulator, In Serial Programer pinout, and Servo and DC motor output pins.
In the middle of all this electronics and software mess I managed to design a Chasis in AutoCAD, and tested it's structural stability and part clearance with Autodesk Inventor (Did this because as I mentioned the previous robot had a tendency to tear itself apart and I used an easily breakable material on it, not a great combination after all; but as I said I'm still working on it). The day after I had my chasis printed in my local Laser cutting workshop, and by that afternoon it was complete (this was on August 9th).
This is my first update on the project, and hopefully I'll have more to present to you guys in a couple of weeks. The finished date of this project is on the 1st of March according to my University, but that does not mean that I'll be done with it, told you we can make a lot of things with this thing and I'm sure I won't by March. You can follow updates on my works via instagram (@ich_heisse_augusto) and fell free to tweet me (@Fre4k4zoid) . Lastly I'll leave you with some reference links down below, thanks for reading :)
Raspi Matlab Getting Started Guide
Raspi as Hotspot Setup
http://raspberrypihq.com/how-to-turn-a-raspberry-pi-into-a-wifi-router/
Raspi as IP Cam Setup
-
2Step 2
Today 30/11/2016 I just finished compiling mjpg-streamer for the Raspi, took me quite some tiime to find a good guide on how to do so but yesterday I found this link (https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=100818) which explains perfectly how to do so. This allowed me to have a continuos image stream over Wi Fi with a latency of at most 100ms. Next week I'll be working on the face tracking algorithm since I discovered it wasn't behaving correctly.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.