Saturday, December 20, 2014

Robie Jr: Progress Continues

Speakers, Servos and Motors Oh MY. Progress continues. I have the arduino board making noises, moving motors or sweeping servos based on serial commands coming from the raspberry pi.

Of course... I found out a few things along the way. First, I really need to be more careful plugging up servos when they pull off usb power. Apparently my motor shield does not supply GPIO power to the arduino in a way that it protects the USB bus. Apparently it doesn't take to much to pull the bus so low the raspberry resets. The second is that the Arduino IDE does not auto save your code when you compile it... DOUGHT. Quicker than you an say compile, upload, sweep I found myself with a reset Pi and my code all sitting in flash on the arduino with a default template set of code in my project. Yay.

Well at least what I had done will not be to difficult to replicate. I also learned that the standard Tone.h and Servo.h files are incompatible on Arduino projects due to some overloading in the timers on the Arduino. Considering it was going to take some more work to run wav files through an arduino connected speaker even if I used an alternative sound library it looks like I am just going to use the jack on the raspberry pi and run sounds from there. I ordered a small cheap bluetooth speaker from amazon for less than 20 bucks that will handle amplification etc... all on its on and work from the sound jack. Has its own battery as well so I won't have to worry to much about powering it/shielding it.

Along those lines I finally pulled up the capture of all the sounds from Robie I captured a year or so ago and broke them all out into individual wav files. So I am not that far from figuring out how to house all these bits and pieces up in Robie and work on building the laptop <->  pi control scheme via wifi. 

The big piece missing at this point is the camera as I have not hooked that up to the Pi yet. The library examples look pretty easy and I have found some examples of folks streaming the camera to remote VLC sessions so hoping the bigger deal will be establishing the serial link for the motion control and receipt of telemetry.

Telemetry:

  • 3 axis accelerometer - serial report back to pi, web serve page with info? 
  • Camera - stream video over wifi to watch on VLC 
  • Planned - RF spectrum analyzer (cheap one on Adafruit) 
  • Planned - Temp (contactless)/Humidity/Pressure
Control:
  • Method:
    • Initial of WiFi VNC connection to Pi driving serial commands to arduino either through ariduino serial session or Python program.
      • Have successfully been shipping commands from the Pi command line to the serial device. Bit awkward if I wanted to control things that way but it works. 
    • Long term goal of establishing a two way link using an as yet undetermined protocol for commands and telemetry to a program running on my laptop and or iPad/iPhone. 
      • Should let me kill the VNC server/session on the Pi and free up some CPU cycles for stuff like image recognition routines
      • setup joystick? 
  • Things to Control:
    • Camera pan and tilt servos
      • up, down, left, right
    • Two DC motors
      • forward, back, left, right
    • Led lights
      • Eyes
        • Haven't decided on whether or not I am trying to drive the old eyes or performing surgery to add new ones. 
      • Connection status? 
    • Planned - Moving arms? Looking like there is no way to do this without surgery or some fabrication... shame I do not have a 3d printer...
Power:
  • Looking like the power will be a bit convoluted to start. 
    • Lipo 7.4v volt 1320mah for the motors going through the arduino shield
    • arduino will also be usb connected to pi due to not having a logic level shifter yet to shift between 3.3v and 5v logic. May shift to adafruit trinket pro 3.3v in the future instead of using a shifter as the price isn't that much different and it would shrink the arduino size and let me use a smaller usb micro instead of the stupid usb a connector on the uno...
    • Speaker will have its own battery but may have it connected to USB battery
    • Raspberry pi running from Anker usb battery
      • May have to put a usb led light on this to keep it from turning off... or making a keep alive circuit as it has an auto shutoff if not enough juice is being pulled. 
  • Actually think all that will weigh about the same, maybe less than the orgininal 4 D cell setup for Robie. May need to perform some surgery to make it fit as the lipo is tiny in the 4 D cell section. 
Future:

Robie is pretty much a nostalgia project at this point but the basis of what I am building has always been intended to go into something a bit more serious. In order to keep me moving I finally did buy a more capable bot chassis . Caught it on sale on Cyber Monday for ~$175 which I consider a real steal. I had already been eying the Dagu Thumper chassis options (4 and 6 wheel bases) but was not really thrilled about what looked to be a fairly cramped area to build up components in. I had always wanted a tank. However until I ran across this one the Lynx motion base was the only one I could find that wasn't very expensive ($$$$) or way to small/cheap. It also had no suspension and didn't look to be easily modifiable to have some. By comparison the T'Rex is simply in another world. It has something like 7cm clearance with nothing to drag on the underside. The spring torsion suspension isn't super beefy (built for load of about 1kg) but it works in pretty rough terrain. Seeing this thing in motion looks like the Howe and Howe Ripsaw tank (youtube it, or you may remember it from Gi Joe). The tank treads are METAL. The Wheels are METAL. Gears are... Metal and everything else is... wait for it... METAL. And it is"        cc            not super cheap flexible thin crap. This bad boy is really stout.

Anyway, I am looking forward to building up some components on the T'Rex. Also looking to add a fossil style skull label, or perhaps a full skull onto this in someway and use that speaker to play some appropriate roars as it roams around exploring :-).  Obviously this beast can't be powered by the arduino motor shield I have so I also have ordered an Orion Robotics Roboclaw 15a dual H bridge controller. On paper it seems to be a better choice than the ubiquitous Sabertooth controllers out there for medium sized bots like this. And the 15a was appealing over the sabertooth 12a as the stall current on the T'Rex is 11a and I wanted a bit more safety margin. For those familiar with this chassis wondering why I did not go with the T'Rex controller which can handle these motors and provides an Arduino in the same package? Well frankly the SparkFun comments on that controller left me a bit concerned it was pretty fragile.

Well since I started this post I have received all the bits in the mail. If I have any complaints thus far it would be about the suspension. It works really well but it is apparently designed for very light loads. It basically uses a torque bar on each of the arms the bogey's are on as opposed to a damper like on higher end RC vehicles. May need to see if I can figure out a modification so that it can carry a bit more weight than just a battery and controller solution. The issue seems to be that if you run in more rugged terrain with heavier than about 1-2kg it can separate drop a track. Anyway... still a really cool design. 


Not sure if I am going to be able to get Robie up and going or not. I have apparently lost some screws for putting him back together. Room is a bit more cramped with the shell on than I thought it would be so I am not sure how to cram the pi and battery in there. I did get him moving around with just the arduino. Will have to do that and film it again. Need to get the eyes lighting up as well. Perhaps next time.... But in this guise there was no interface, just some canned movement code loaded on the arduino.