This is an extension of the pervious robot, derpderp. A friend wanted something to use for makerfaire Detroit to show off a bluetooth attached armband. That sensor interfaces with python on a raspberry pi 3, and since I have some experience making python controlled robot platforms I volunteered to help.
The code I wrote just conflates the original derpderp code (which I use to drive the robot) with the wheelchair robot code that I use as a framework. The additional things are setting the servo angle (what used to be the lidar platform), turning the light on and off (added to the lidar platform), and getting the temperature and humidity from an onboard sensor. When making this change I found that the battery wasn’t working so I dug up the charger. Then I found it wasn’t charging… so I tore apart the charger and bypassed the fuse. It still wasn’t charging so I tore apart the battery and bypassed the fuse. Then it finally worked, but that battery was so anemic anyway I decided to upgrade it.
The original battery was a 9.6v 500mAh battery, I replaced it with a lithium jump pack. I had bought this jump pack for my car with an unreliable battery (which I eventually replaced) and somehow ended up running it over in my driveway. I don’t even remember taking it out of my car and the next day it’s in pieces on the driveway. After looking it over it still looks intact. The plastic is shattered and the box that goes between the battery and the jumper cable clips has been crushed and the open frame relays inside will never function again. That box, as far as I can tell, has a microcontroller in it that just supervises the closing of a bunch of little parallel relays to connect the care battery in parallel with the lithium pack (no protection whatsoever). To me that means that I now have a connector and cable that will give me an unregulated voltage that I am glad to use for my motor power. The charger board for the jump pack has a variable dc-dc on it to make different voltages, a usb port, and a flashlight. I took the flashlight off and drove it at about 20mA with a resistor and a FET off the regulated 5V I’m making on the robot. That’s the headlamp on the robot and it’s steerable with the servo as well as PWMable. The control board is now only useful as a charger for the bare lithium pack as the battery voltage is not passed through it before hitting my robot.
The commands are:
sCmd.addCommand(“HUM”, humCMD); //no args
sCmd.addCommand(“LIGHT”, lightCMD); //0 – 255
sCmd.addCommand(“TEMP”, tempCMD); // if ‘1’ then F, if ‘0’ then C
sCmd.addCommand(“TURN”, turnCMD); // sets turn -1000 to 1000
sCmd.addCommand(“SPEED”, speedCMD); // sets speed -1000 to 1000
sCmd.addCommand(“ANGLE”, angleCMD); // sets angle of servo, 20 to 160
That’s a fairly easily controlled robot. I don’t know exactly how the project went because I was on vacation for the week leading up to makerfaire, but there were some problems sending the commands from a raspberry pi (and I still don’t know why, it was over USB).
code is here.
pics are here.
autonomous version is here.