Tuesday, July 16, 2013

Adding Ping Ultrasonic Distance Sensors, So It Don't Go Boom!

I'm adding ultrasonic distance sensors to my telepresence robot to keep it from running into walls or other obstacles which may damage it. Ping ultrasonic sensors use sonar to create a pulse that it can read by sending a signal out and seeing how fast it bounces back. In my code, I generally say if the sensor returns a value that is under 20 centimeters, then cut the motors. I have yet to figure out what happens once the robot is within that 20 centimeters. Since the power to the motors is cut, how am I going to get out of that situation? I've got a couple ideas but want to think about it a little more. 


I've got two sensors working really well right now. They both work completely independent of each other and they don't interfere with the motor code that's on the Arduino Mega. So far everyone's playing nice together. I found a library that allows an array of sensors to work together and so far, it's doing everything I want to do with the sensors. It's called NewPing and can support an array up to 15 sensors.

Parallax sells these sensors for $29 but I found them on ebay at 5 for $10. I plan to have 4 total; two in the front at about 20 degree angles and the same for the back.
Proof of concept for the sensors. The finished product will look way better.

Thursday, July 11, 2013

First Steps .. or Revolutions.. or Trip!

My robot (still don't have a name for him) went for it's first stroll tonight. I was stuck for over an hour because I wasn't able to successfully able to upload a sketch to the Arduino Mega. Since the Arduino Mega is connected to the Raspberry pi via USB, I am able to program it straight from the Raspberry Pi. I do this by installing the Arduino IDE, and VNC Server on the Raspberry Pi. Then I downloaded the TightVNC Client to my windows machine. I start the vnc service on the RPI and then boot up the client on my windows machine which takes me to the UI interface that RPI has. I can then access the Arduino IDE just like I do on Windows.

There is a caveat to this setup. Because I'm using the 'php_serial.class.php" so the webServer can write to the RPI's serial port, I need to put a capacitor between the 'reset' and the 'gnd' on the Arduino to keep it from resetting each time the PHP serial class closes it's connection. This is interfering with my communication between the webServer and the Arduino. I was successfully getting the command from the webServer to the Ardino, but I wasn't able to read my acknowledgement back from the Arduino to the server so I could display it. So this work-around works and it was the capacitor that was not allowing me to properly upload my sketch from the IDE to the Arduino. I finally realized it, pulled the capacitor long enough for it to upload and put it back on. Works like a charm now.




Wednesday, July 10, 2013

Wheels and DC Motors

 
After doing a couple night's worth of research, I settled on the Parallax 7.2V Motor, Bracket and Wheel Kit. The wheels on the website were blue but when my order came in, they were orange. Turns out that I think they look really cool so I'm glad! I believe these are exactly what I was looking for.
 
 
 
 I had some concerns with mounting the wheels to the platform. If I was going to drill the holes manually, I would have to make sure they were perfectly straight or else they would be out of alignment causing them to fight each other when moving. So in my Solidworks model of the platform, I added the holes. This would ensure that the holes would at least be straight on the platform. Putting bolts that are too thin would also increase the chance of them not being aligned also so I made sure that I used the largest possible bolts.

 

The Platform and Back Wheel Support

I was banging around different material for the platform and I know that I will be going through a couple iterations. I knew that plexiglass would look cool but I questioned the stability of it. Turns out that it's not too bad at this point.

 
 
The back wheel support was a design that I made in Solidworks and printed on a Solidoodle 3. The idea with this is that the dc motors would connect to the front wheels and they would also be responsible for steering. The back is a ball caster, allowing the robot to do a true 'turn on a dime'. My first robot had wheel casters and they worked but the problem with them is that if the wheel is at 90 degrees from the front wheels, if you wanted to move forward, you would not be able to go in an immediate straight line until the caster straightens out. The ball caster eliminates this problem. 
 
 
 
 
The file created for the back support ball caster.