Monday, July 25, 2022

Is your robot a jerk?

How many times have you seen a video of a robot that moves in a jerky motion? This is probably due to an on/off approach to speed control. This is an easy trap when controlling a servo. You have to move from A to B. One second you are setting it to position A and the next you set it to position B. The servo responds with a jack-rabbit start and gets to the new position as quickly as possible.

A better approach is to accelerate slowly till you reach full speed and then decelerate to stop. The need for this was first illustrated when a motor being controlled jumped and fell off my table. Since then, the speed profile has been tested by keeping the motor on its own on a flat surface. If it falls over, it has failed the test.

Monday, July 18, 2022

Serial Multi-drop on an ESP8266

My servo controller is being moved from a PIC to an ESP module. Each servo motor has its own controller connected to a bus. The bus is a TTL serial line. In order to connect multiple controllers on the same bus, the transmit line of each slave controller has to be floated. They are pulled up at the host and a slave controller enables it only when it is ready to respond to a host request. This ensures that only one slave is transmitting at any given time.

I am, for now, using the Arduino framework. This puts a couple of layers between my code and the hardware. This blog looks at how to implement a floating transmit line on an ESP. To test the prototype I have the line set to half the power supply voltage of 3.3V using a couple of resistors. This helps me check if the output is floating or not. In the trace below, you can see a floating line starting to transmit a response.

Tuesday, July 12, 2022

Driving a WS2812B with an ESP8266 (Arduino)

With most PIC chips disappearing from the market as part of the semiconductor shortage, I looked around for options for my smart servo controller. I finally settled on the ESP8266 module - specifically ESP-01F. One of the features I had in mind was to use a WS2812B RGB LED to indicate the various states. I already have a servo control loop that is executed once every 20ms. It made sense to squirt out the data for the RGB LED as part of this service routine.

There are many ways to drive a WS2812B from an ESP8266 in an Arduino environment. This is yet another way. This drives a single WS2812B using a bit-banging approach.