post

Robocar: mobile phone driven vehicle

This is a build guide for a robotic car that can be driven by a cell phone.

1) Parts and Equipment

Equipment list
Soldering iron and basic competency
Digital multimeter
Computer to program raspberryPi
Battery charger

2) Assemble the chassis

ServoCity Actobotics has provided an excellent video of how to perform the mechanical assembly of the chassis.  Pull our your hex wrench and plug it together as shown below:

3) Electrical

Once the chassis is assembled, it is time to wire up the motor controller and brain.  I have chosen to use as raspberry Pi with the following Motor Hat: Pololu G2 18v22.  Each side (left/right) will be slaved to a given H bridge (the blue ports on the side).

I recommend using heat shrink tubing.  For this, cut your wire to length (or if you are using the aforementioned JST connectors, just fire in) such that it reaches between the place at which you mount your motor hat and the solder point on a given servo, and ensure you put the shrink wrap on the wire before you solder it, or you will embark on useful training on how to de-solder and re-solder your wire.

Maker:0x4c,Date:2017-9-24,Ver:4,Lens:Kan03,Act:Lar01,E-ve

Once the tubing is on, solder each wire to a given terminal.  The H-Bride will allow you to reverse the polarity of each motor, but if you are color coding your wiring, it is good to ensure that a given color hits the same terminal on each motor.

Once the wires are soldered onto the terminal, it is time to add some heat to the shrink wrap tubing.  You can use a hair dryer or a lighter to get it to shrink up, forming a nice seal around your soldering job.

4) Software

Once you have your motors connected to your hat, it is time to fire up some software.  I have published the code at the following github repository:

https://github.com/mechiris/RobotCar/tree/master/robotcar

For an initial test, you can use the following example.py from the Pololu motor control repo.  It will simple run the motors forwards and backwards to ensure that you have things wired up correctly.

If that works according to plan, it is time to connect things up to drive with your phone.  I am using a fantastic mobile IoT application builder called Blynk: https://www.blynk.cc/

This allows you to connect any IoT device for control/interface with your phone, using drag and drop widgets.  For this application, I tried a few different ways of driving the car with my thumbs, and found that providing two separate widgets (one for each thumb) provided the most intuitive driving experience.  This is similar to how a tank works, with one widget controlling both the left wheels, and the other controlling both the right wheels.  Whenever I mapped the velocity of both wheels back to a single widget, it felt a little clunky and I preferred the transparency of driving each set independently.  Your miles may vary.

To do this, drag two joystick widgets out.

Screenshot_20181101-135415

I set them using the following parameters.  Note that the Vertical position is the only value of interested with the two thumb setup, and I mapped it from -128->128.  Additionally, ensure that your [0] pin matches whatever you have configured to listen on the other end in your python library (I believe I set v1 and v3 as defatul). You can do whatever range & virtual pins you like, but you will need to update the python code receiving the signal should you choose to do something different:

Screenshot_20181101-135432

At this point, you can copy your secret key from your blynk application into the creds.txt file in your robotcar repository on your raspberry pi, and you are off to the races!

5) Feedback

If you have additional tips, or areas that were not clear while reading this build guide, I would love to hear about them.  Alternatively, if you built something cool similar to this, it would be great to see your creativity! Please reach out.

post

Robotic arm: A raspberry pi driven 6-axis ROT2U implementation

This is a build guide for a 6-axis servo driven robotic arm.  It includes open source software for positioning the arm using a raspberry PI and PWM based servo control.

 

Part Number Total Cost ($)
Rot2U 6-axis arm with MG996R servos 1 70
Adafruit 16-channel servo hat 1 18
Raspberry Pi 1 35
6Volt ~15amp power supply 1 X
Total: 123

Equipment list
Soldering iron and basic competency
Digital multimeter
Computer to program raspberryPi
Quickgrip clamps or baseblock to hold down robot

Assembly

Servo hat

raspberry_pi_oneservo

This tutorial makes use of the Adafruit 16-channel raspberry pi servo hat, although any PWM servo driver will do.  Detailed instructions on how to solder on the headers, attach the servos, and affix the hat on the raspberry pi are included here:

https://learn.adafruit.com/adafruit-16-channel-pwm-servo-hat-for-raspberry-pi?view=all

This tutorial assumes you have connected 6 servos to the servo hat (positions 0:5).

A point of note:  The MG996R Servos recommended above can draw several amps of current.  Please ensure that the power supply you are using for your RPI is isolated from the servo power, or else large current draws can cause brownouts on the pi. I used my desktop DC power supply (Long Wei PS-305D) because I had it laying around, but it is likely overkill:

Maker:0x4c,Date:2017-9-24,Ver:4,Lens:Kan03,Act:Lar01,E-ve

Maker:0x4c,Date:2017-9-24,Ver:4,Lens:Kan03,Act:Lar01,E-ve

Robot assembly

I followed the following youtube video that shows mechanical assembly instructions for the ROT2U:

Since I assembled mine, a video with English commentary has been published here:

Software

 

Screen Shot 2018-01-01 at 1.34.35 PM

I wrote a basic software library for controlling the arm.  It is available here:
https://github.com/mechiris/RobotControl

Detailed installation instructions are included in the README.md.  In short, you will generally start at the bottom of the list and work up.  You can set different servo positions directly using menu option #3, selecting a servo, then inputting a position.  Once you have the robot in the location of interest, you can list the servo positions.  These positions can then be added to create a teachpoint.

To create teachpoints, edit the Teachpoints.csv file on your local machine:
https://github.com/mechiris/RobotControl/blob/master/robotcontrol/Teachpoints.csv

Blanks indicate not to change a given servo position, while values will move the servos in parallel to the location(s) of interest.  A human readable name (Position) is what will show up in the menu for selection.

Once several teachpoints are set, Sequences of these teachpoints can be implemented.  Similarly to setting teachpoints from servo positions, you can edit the Sequences.csv on your local machine:
https://github.com/mechiris/RobotControl/blob/master/robotcontrol/Sequences.csv

In this file, semi-colon is the delimiter, and commas represent lists within a given cell.  You can have a series of teachpoints for a given sequence, and a list of similar length with associated delays.

Improvements

Every project leaves some work undone.  It might be useful to provide teachpoint or sequence addition via the cli menu, instead of hand editing the CSVs.  Any other good ideas on how to improve the software, please submit a PR!

 

post

RoboShark: The mobile glowing robotic shark.

RoboShark

This is a maker guide for creating a robotic shark that you can drive with an android mobile device.  The body is comprised of three separate pieces of acrylic, that are surrounded with oscillating el-wire to give the appearance of motion/chomping as they flash.  The base is built on top of the Cherokey 4WD robot chassis. This chassis will work with a variety of microcontrollers, of which I chose to use an Arduino Uno. Complete bill of materials and build instructions are included below.  If you are going to fire in an recreate, please pre-read the lessons learned in the appendix so you can avoid some of my mistakes!

1) Parts and Equipment

Part Number Total Cost ($)
Cherokey 4WD Robot Chassis 1 50
7.4V Lipo battery 1 20
12V Battery pack 1 5
Arduino Uno 1 25
Arduino Proto Shield 1 10
DF-Bluetooth Module v3 1 22
el-wire: blue 2.5m 3 60
12V el-wire inverter 1 5
Tinkerkit T010010 relay modules 3 30
Acrylic 1/8" blue 4 100
Acrylic cement + applicator 1 10
28 gauge black steel wire 1 5
M2.5 screws and nuts 50 10
Other minor electronic odds & ends
Total: 352

Equipment list
Laser cutter (Trotech Speedy 300)
Soldering iron and basic competency
Digital multimeter
Cell phone (or other bluetooth device to use as controller)
PC to program arduino
Quickgrip clamps

2) Assemble the chassis

400px-Rob0102hole

Assemble the chassis for the Cherokey 4WD robot according to the following document:

700px-InstallationGraph
Cherokey Assembly Guide (PDF)

Cherokey Assembly Wiki

I made a few small modifications to the default build.  First, I added an additional standoff to make the interior section slightly taller, to allow for a little more space for the relays, inverter, and Arduino shield.

I made a small plastic piece to hold the relays in place.  Originally I had 4 here, however 3 ended up being sufficient for the final project.  These screw into the acrylic holes using M2.5 screws, then the whole assembly is screwed to the underside of the top plate of the Cherokey:

Relays Relays2

The inverter fits directly behind the Arduino in the center of the chassis, and can be affixed using small zip ties to hold it in place:

inverter

3) Electrical

Circuit diagram

electricaldiagram2

Relay wiring

Relays are essentially electrically operated switches.  In normally open (NO) configuration, if the input signal goes high, it closes the switch, and vice versa when the input signal is low. Relays isolate the input trigger signal, from the switch on the right hand side. Here I chose a mechnical relay, which physically moves an internal component to connect the circuit.  Other options include MOSFET relays, which are better for high speed switching (e.g. PWM) applications.  The Tinkerkit relay shown here is discontinued I believe, but at the time of writing this article, there are still some in stock at Mouser.  Any other mechanical relay should do just as well.

According to the diagram above, we need to provide +5V, Ground, and the input signal.  For each relay, we also need to have the middle input pin connected to a digital output pin on the Arduino, such that we can control the state of the switch through software. These are shown as green, orange, and yellow wires in the diagram, and are connected t0 pins 8-10, as pins 0-7 were used for controlling motors and talking with the bluetooth adapter.  In order to make the relay connections, I used the standard Tinkerkit wire, and soldered headers onto the Arduino shield for quick disconnect.

shield

Additionally, we need to wire up the opposite end of the relay to turn on the el wire when the input wire is active.  In order for the lights to be active, we need to complete the circuit with the inverter.  The lights will turn off, if even one portion of that loop is broken.  We will be using the relays in normally open position.  This means that if there is no signal on the input, the switch is open, and the el wire is off.  If the input wire on the left is active, the switch will be closed, and the el wire will light up.  At the completion of this stage, we have three independent software addressable el wire pieces that we will later use to flash different shark outlines in sequence.

Motor / Bluetooth wiring

The Cherokey chassis has a nice PCB design for connecting your Arduino to the servos and bluetooth module.  From their website, you can connect pins 0-7 as follows:

800px-Cherokey_Arduino

Software

The Shark Car relies on bluetooth communication to drive.  Any bluetooth compliant device will work to send the appropriate signals.  I used the open source offering from Silver Coder, who has kindly provided a free Android bluetooth application for driving robotic vehicles (Thanks!).  You can find the code for it here:

https://play.google.com/store/apps/details?id=pl.mobilerobots.vacuumcleanerrobot&hl=en

Now, we need to implement the code to receive signals from this software.  The DF Robot bluetooth module receives a single character for each of the directions, and we need to implement listening code to control the motors in a reproducible fashion based on each signal.  Additionally, we need to develop a solution to simultaneously oscillate the relays to control the lights.  The arduino does not do multithreaded software, so this is a bit of a hack, but it proved functional.  Source code was modified from github user srebroa and found here:

https://github.com/mechiris/Arduino/blob/master/Arduino_controlled_robot/Arduino_controlled_robot.ino

Shark Body

My wife designed the shark body.  She first prototyped it using cardboard, to get the dimensions and center of gravity right.

shark

Once she was happy with the design, she sketched up plans for the laser cutter in Illustrator.  They are available on ThingVerse here:

http://www.thingiverse.com/thing:942809

For the body, we chose 1/8″ Acrylic sheet from Tap Plastics in SF.  Their staff was really helpful and knowledgeable.  If cost is a consideration, you could use alternative materials for this part.

To cut the design, we used a Trotec Speedy 400 at Techshop.  For acrylic, you want to start at lower power/speed and figure out what settings provide a nice clean cut without melting or burning.  For this we used the ‘holestest’ file included with the thingverse package.  This also let us test the diameter of the holes which needed screws, to ensure a snug fit.

Once your settings are correct, you should keep the protective paper on the acrylic while you cut to prevent any smoke/burn marks.  Always cut interior holes/features before the main body, as parts can shift once they are freed from the bulk piece of material.  A video of the cutting process can be found below:

After you cut the raw pieces, it is time to assembly the shark body.  For this task, we used acrylic cement and a needle applicator.  If you put the acrylic pieces orthogonal to each other, then apply a small amount of the cement, the surface tension will pull it into the joint to form a tight bond.  Note that this is a solvent, so it is essentially taking two pieces of material, and fusing them into one, as opposed to putting a third party substance between them to join them (like glue).   After you have applied the cement to each piece, it will fuse with a weak bond within ~30 seconds.  Let it sit overnight, preferably clamped down if possible, for it to fully cure and form a solid bond.

sharkcar

Once the acrylic body is properly fused, you can attach it to the chassis using m2.5 screws. Note that there are room for improvements with the design (described below).  Note that you should plug in the three el-wire leads and thread them through the port on the chassis and body prior to screwing it down.

wire

Once the body is attached to the chassis, you can start to affix the el wire to the holes using the steel wire.  For each hole (or every other), set the el-wire on the surface of the acrylic, loop the steel wire around and through the hole, then twist it off to tighten it.  After you have affixed all the el-wire, you can use pliers to cut off the excess steel wire to make things look neat.

snip

Once you finish, your body should be looking good with the el-wire affixed!

fullshark2

Improvements

As with every project, if I could do it all over again, I would do it better.  My wife did an incredible job on the shark design, but the hole pattern I added isn’t the easiest to attach to the chassis.  The slotted design was there to add flexibility, but the vertical shark body occludes some of the best places for screws, so you have to have nimble fingers to slot them inside.  Additionally, the ideal location for the back slots are blocked by the piece containing the relays. Feel free to improve upon the design should you cut your own!