Posts

Showing posts from August, 2015

Motor drivers

I previously posted about a DRV8835 dual motor driver. In my new balancing robot, I've used a a TB6612FNG instead, basically because the board is a tiny bit bigger, so I can use PCB card guides to hold it. Pololu and Sparkfun both make carrier boards which are nearly identical. If you use the TB6612FNG like an LM293D, then it drive/breaks rather than drive/coasts. For lots of things, this works well: the relation between speed and PWM pulse width is more linear. I'm not sure how it interacts with PID though: the torque applied depends on the speed. When the speed is low, the torque is higher. That tends to happen when the bot is close to upright and balance. That sounds sub-optimal. It turns out that if you just set the PWM pins on the TB6612FNG high, it then behaves just like a DRV8835 - i.e. you can choose between drive/break, and drive/coast. You again need two PWM pins, but these STM32 boards have plenty of timers, each able to drive 4 PWM outputs, so that's fine.

ESP8266 and the balance bot

Image
I've built a new balancing robot. Unlike the last one it actually works a bit, which is nice. I've been working on it for quite a while, and neglecting to post about it, which leaves me with the dilemma of what to write about first. One of the most annoying things about the previous development experience was using Bluetooth. Specifically Linux Bluetooth support. The main reason for using a Bluetooth serial module was it's low cost. Now you can pick up a ESP8266 WiFi module for less than £2. Since WiFi is so much better supported than Bluetooth, it seems like a no-brainer. There are quite a few different formats out there, and I've bought a few different ones. At the high end are the NodeMCU boards. These include a usb serial adapter, and require the least fiddling around to get going. I recommend you get one, because what you are going to find immediately is you need to flash whatever you buy with a newer firmware. The flashing tools will just work with one of

Raspberry Pi PWM

There is now an accurate way to do PWM on the Raspberry PI: pi-blaster . I decided, to make things easier than using a micro controller, to use a Raspberry Pi to control my aquarium light. I've tried using a few other PWM libraries, but pi-blaster is the first one not to flicker. Here's the little python script I wrote. I should try submitting a pull request to change pi-blaster to use sockets, and conform to the LSM by putting it's socket in /var/run or similar, but the pipe interface is a good idea compared to having to have a binding to each scripting language.