Saturday, 6 August 2016

Old friends

So, I was trying to find a microcontroller board with a ton of 5V I/Os and, as usual, finding nothing at a reasonable price. A Pi Zero is $5, so why is a dev board for an 16MHz 8-bit MCU $50? But then I realised, I don't necessarily need 5V I/O - I need 5V tolerant I/O.

I've spent quite some time (as you might know if you've seen other blog posts) working with the TI Stellaris Launchpad - now known as the Tiva-C Launchpad for reasons I never did understand. I thought I've had a look at the datasheet and low and behold - 5V tolerant I/O.

So, a plan is forming:
  • Create a base board for the Launchpad, like I did for the in-car dashboard
  • Drive the L298 inputs from a open-drain GPIO with a pull-up.
  • Read the quadrature encoder inputs directly (the GPIO will deal with it OK).
  • It can interrupt on any GPIO pin, so no problem there.
  • It's fast - A 67MHz Cortex-M4F won't have any problems running four seperate PID loops.
  • The Pi can connect via USB for both power, control (Serial) and flashing/debug.
  • I know I can get the programmer to work.
  • I know I can program it in Rust...

PiWars 2017...?

I may have accidentally submitted a PiWars 2017 application. Ooops.


Key upgrades for the old robot, I think would include:
  • Proper four wheel drive
  • Closed loop motor feedback
  • Ultrasonic ranging on the sides as well as the front
  • Light sensors in place of the camera for line following
I dusted off the 2014 entry myself and some friends built and the LCD and the PS3 interface still work well. But I'd previously stolen most of the motor driver circuitry, so that needs revisiting.

To make the sensors work, I need more interrupt pins than the two that I have available on the AtMega 328 I used last time. I really need two for each wheel speed sensor, plus one for each ultrasonic sensor. I'd use a Cortex M4 like the Stellaris Launchpad, but the wheel speed sensors of course output 5V, as are most ultrasonic sensors and the inputs on the L298 H-Bridges I use.

I feel a custom circuit board coming. Oh dear oh dear.