Jon's Place

Friday, February 14, 2014

MicroPython Board With a Crystal, and a New Motor Driver Board

So, I ordered a few of the crystals Damien used on the official MicroPython board, and although physically it isn't a perfect fit, it works, so I now have a nice clean board.

I also got rid of the orange LED, and replaced it with a proper blue LED (I didn't have any of those left when I put the board together). So, everything is as it should be, and is working nicely.

I also ordered a couple new motor driver boards, and have one hooked up now - it is working great. uCee will be back together again shortly, driving around with my custom MicroPython board (all the videos shown up until now were with the Teensy 3.1 running MicroPython).

New Motor Driver Board
Things are back to working, which is a good thing. I'll be bringing uCee (along with Roz) to PyCon in April in Montreal, since both robots are powered by Python.

Friday, February 7, 2014

Of H-Bridges and 3.3 Volts

So, in another twist of this ongoing saga, it turns out the h-bridge I was using for uCee is not designed to work properly with 3.3 volt logic. I had it hooked up, but the motors weren't turning. I took it all apart, hooked up my logic analyzer to the logic pins, and sure enough I was getting a valid signal. I took my multimeter and was going to test the battery voltage to make sure everything was okay, but when I touched the battery probe to the ground pin on my MicroPython board, the motor started running.

That was weird. So I reset it, and tried again. Same results. I tried it with the tip of a screwdriver, touching one of the +5 volt pins - same results.

I went and found the (now discontinued) product page on, and sure enough, the minimum required voltage is around 4.2 volts.

This is only the second robot I've built with 3.3 volt logic (NanoSeeker was the first), and the ARM chip I'm using (STM32F405) has 5-volt tolerant logic pins, so I haven't had to think about it too much so far. Clearly, I didn't think enough about it. It worked fine with the Teensy 3.1, but it clearly doesn't with my new board.

Anyways, I found this cool Canadian company called Diigiit Robotics, that had one of Pololu's new much cheaper h-bridges in stock, so I ordered it. This h-bridge will work with logic down to 2 volts, so I should be safe.

I'll have to print a mounting plate to hold this board in place - the board is much smaller than my current h-bridge, and has no mounting holes. I'll design a plate that is in the shape of the old h-bridge, with the middle cut out and some clips to hold the board in place.

Monday, February 3, 2014

MicroPython Board Working

Things weren't looking that great as of my last update, but I soldered in an 8 MHz ceramic resonator I had in one of my parts bags, and the USB stuff magically started working!

So, I have a fully functional MicroPython board now. Below is a picture showing my new board on the left, with my Teensy 3.1 carrier board on the right. The new board is a few millimeters longer, but the same width. The connectors are laid out in a much more usable fashion. The four wires you see coming out of the connector go to a couple push buttons, and allow me to reset the board, and also put it into DFU programming mode. Once the MicroPython software gets more stable and complete, I won't be re-flashing the board much, so I can remove the buttons. Its hard to get at the surface of the board while its in the robot, so I didn't want to put push-buttons on the board.

Two Boards Running MicroPython

Sunday, February 2, 2014

MicroPython Boards, Crystal Trouble, Flashing LEDs

So, its a long and sordid tale. I got my boards back on Friday:

They sure look pretty. I soldered up the first board, and found out that I had switched the polarity of my battery connector between the Teensy and this board, so I let out a bunch of magic smoke when I first plugged it in. Fortunately, it was just the 5 volt regulator that smoked, and not the ARM chip, so I replaced the regulator and fixed my battery plug. I hooked everything back up, and...

Nothing. No response over USB. I did a lot of troubleshooting, and determined that it was probably an oscillator issue.

That picture shows the BOOT0 line (third row), the RESET line (second row), and the oscillator (top row) hooked up to my logic analyzer. So you pull BOOT0 high, and then, while its high, pull RESET low. At that point, the chip is supposed to start up the external oscillator, which clearly isn't happening.

My brother suggested I could use one of the serial interfaces to the bootloader, and he went so far as to put together a blinking LED "Hello World" style application I could flash, along with the serial bootloader programming code from the Espruino project. I re-purposed my IMU port (which uses I2C normally, but the SCL/SDA lines are also Tx/Rx from USART3 on the chip). I removed the I2C pullup resistors, removed the crystal, grounded the USB D+ and D- lines, and plugged in an FT232 USB to TTL converter to my Ubuntu laptop. I was able to program the chip successfully using that setup, so now I know the other issue is a crystal issue, and not something else fundamental wrong with the ARM chip or my board.

So, I'm not sure where to go from here. The math says I should be using 6 pF capacitors with the crystal, but something clearly isn't working.

I'm going to code up an 8 MHz signal generator using my Teensy 3.1 board, and see if I can get USB working with an external clock source like that. If that works, then I need to try and figure out why this crystal isn't working.