Jon's Place

Tuesday, January 28, 2014

Custom MicroPython Board

One of the things I've been working on in my spare time is a new board for uCee. I was originally going to use the actual MicroPython board that I will get from the KickStarter campaign, but I decided to build my own instead for a couple reasons:

  1. It will fit better, and be easier to connect everything to
  2. I want to start playing with more advanced micro-controllers, and building your own board is definitely a good way to make that happen
The other thing I decided after my work-related adventures with the ammeter board, is I wanted to use a PCB design tool that can generate the PCB with the appropriate connections from a schematic. Most hobbyists use Eagle for that, but I absolutely detest the user interface, so I decided to try a different package, namely KiCad. The user interface definitely takes some getting used to, but once I figured out most of the idiosyncrasies, it is quite usable.

Damien George (the guy behind MicroPython) very nicely published the schematic for his latest revision of the MicroPython board, so I shamelessly copied what I needed and added my own parts that uCee needs, and I ended up with something that should work.

Here's my schematic:


And here's what the PCB looks like, first with the bottom layer hidden (which makes the top much more understandable), and then with the bottom later visible:



KiCad can also show you a 3D rendering of what your board would look like, but you have to supply 3D models of any custom parts you include. My board has a whole pile of parts that I had to create my own footprint for (usb connector, uSD connector, all the Hirose DF-13 2, 3, 4, and 6-pin connectors, etc). So I went to the manufacturers website, and found CAD files for most of them, and the imported them into Rhino, scaled and positioned them correctly, and then exported them as STL files. Wings 3D, although nowhere near as capable as Rhino, has a WRL exporter that KiCad is designed for, so I imported the STL models into Wings 3D, colored them, and exported them as WRL files. I then applied the 3D model to each component footprint, which allows me to generate this:


All in all, not bad.

I plan on sending in this board to get made later this week, so hopefully I'll have my own MicroPython board inside uCee within a couple weeks.

Saturday, January 25, 2014

uCee With A Lid

So, the plan all along has been to print a lid for uCee, i just haven't gotten around to it until today.

Way back when I first started this project, the very first thing I did was create a CAD model of the robot:

uCee - CAD Model

Now that the robot finally has its top, you should be able to see the resemblance:

uCee - Real Robot

So, I think it has turned out pretty good, all in all. I just ordered a new pair of batteries for it, so by next weekend it will hopefully work a little better (the batteries I have now are ones I bought back in 2006 for NanoSeeker, and they are pretty much toast). I also have to put together 3 ProxDot sensors, and mount them.

For now, I'm going to work on the software, which can be found (in its current simplistic form) in my GitHub repository.

Here's another video, this time with the top on:


uCee - Machining Axles

So, this morning I cranked up my Sherline lathe, and machined some brass axles for the four idler wheels (the ones that aren't attached to a motor).

Idler axles machined from 3/8" brass rod
To give a sense of scale, the smaller part of the axle is 3mm in diameter and about 13mm long. The larger part is around 9mm in diameter, and 2.5mm long.

Here's a neat picture I took while I was putting it all back together again:


You can clearly see the white encoder disks on the two motors, as well as the rather tight space between the h-bridge board (on the bottom) and the Teensy carrier board above it. I don't have the ProxDot sensors assembled or installed yet - they plug into the small right-angle plugs on the bottom of the carrier board.

Friday, January 24, 2014

MicroPython

So uCee is now running MicroPython on the Teensy 3.1, and moving around, avoiding obstacles (in a very simplistic manner).


Its pretty cool, and I can already do a lot of the stuff I need to in order to run this robot. We need to add interrupt on change for input pins, so I can handle the encoders, and some I2C stuff to talk to the IMU. The rest is just coding...

You can see my current code in my Github repository.

Thursday, January 23, 2014

uCee Coming Together

So my Teensy 3.1 carrier board I ordered from OSH Park finally showed up (took 5 weeks to get here from when I ordered it, but I can't complain - the price was right).

I still have the idler wheel axles to machine (I'm going to machine them from brass on my Sherline lathe), and I still have to put together my ProxDot sensors, but everything else is put together now, so I'll hopefully only have to strip the robot back down one more time before it is ready to roll.

uCee - Getting Closer
 The h-bridge is mounted and wired up under there, although you can't see it. Here's a picture of the Teensy carrier board (populated), with a blank one beside it (OSH Park gives you three boards):


Here are some more pictures of the robot:




I also have to order the batteries, although for now I can run it off a wall supply. My brother has MicroPython (in its current form) ported to run on the Teensy 3.1, and he's got a cute little robot running off it, so I'll have this guy running Python pretty soon.

Thursday, January 2, 2014

uCee Motoring

Perhaps "motoring" is a bit of a stretch, because it certainly isn't moving yet, but the motor code is running and working.

Here's a quick video showing a simple test of the PWM speed control of one of the motors:


As I move my hand closer to the IR range finder sensor, it slows the PWM down. Very simple, but an easy way to test that speed control is working.

The code for this is on my Github repository. Right now the current readings I'm getting from the h-bridge board are all over the place when its running at full speed. I don't expect to ever run this robot at full speed, and the current readings settle down as the motor slows down, so hopefully that will make them useful. The encoders are rock-solid, using the interrupt pin capabilities of the Teensy 3.1.

I'm going to use this PID library to implement closed loop speed control with the encoders. There's a really good multi-part writeup discussing how it all works - highly recommended. I'm going to translate the encoder ticks into mm/second, and use that as the Input for the PID library. I will specify the requested speed (Setpoint) in mm/second also, and if my conversion routine is correct, the robot's speed should be fairly precise.