Tuesday, June 10, 2025

Driving a WS2812B with a PIC

One of my projects needed a small footprint μC. For a while, PIC chips had disappeared from the market post COVID and I opted for the ESP8266. But now, they are not only back but newer chips are available. I was using the PIC 12F1840 but I had outgrown the program memory of 7K. The PIC 16F18115 has twice the program memory of 14K. Besides some enhanced features that are not of interest, it is actually cheaper. While it has an internal oscillator of 32 MHz, it is a lot slower than the ESP8266. This will make driving the WS2812B a bit of a challenge.

There may be many ways to drive a WS2812B from a PIC using some peripherals imaginatively. This is yet another way. This drives a single WS2812B using a bit-banging approach.

The SK6812 is a good substitute for the WS2812B. The datasheet timings are a bit different from the WS2812B, though in practice, they may still interoperate. I have tried to generate timings that are valid for both chips as per their datasheets.

Friday, August 16, 2024

Inside a Linear Actuator

Linear actuators are getting easy to obtain and relatively cheap. The same cannot be said of linear servos. The two have a lot in common except for the ability to control the position precisely. The usual way the commercial servos do it is using a multi-turn potentiometer. I decided to take a different tack. And the best way to implement it is to take one apart and see how they can be engineered to provide servo operation.

The full sized linear actuators (500+ mm travel) I intend to use are expensive and I need six of them. A good approach would be to try it with smaller actuators (200m travel) and get some experience using them. The ones I opted for are shown below in retracted and extended state.


Sunday, October 1, 2023

Chakravyuh - A Labyrinth

Decades ago, back in school, we used to doodle a labyrinth. I thought it would make a cool painting. A bit stark and monochromatic but intriguing, nevertheless. All I needed to do was to figure out a way to draw a geometrically defined version of it.

After a bit of analysis, I figured out the various arcs to be drawn. This was done in a CAD program (TurboCAD) and saved as SVG. Then I used GIMP to rasterise it. This allows me to scale it to any resolution. I chose a 3200 x 3200 pixel image. This was reproduced on an 88 cm acrylic on glass print from the Canvas Art Factory.

Monday, July 10, 2023

A New Workbench

I am in a new house and as I was debugging my circuit on this small, cramped table, I looked around me. Oodles of space. Why not build set up a decent workstation? This is how and what I ended up with.


Everyone has their own way of setting up their work table. This depends on what they do there along with space and cost constraints. This is how I set up mine. It may not work for everyone, may be not even for me! But there may be a few ideas worth borrowing.

Monday, December 12, 2022

SMD Hot Air Soldering

Once I started using SMD components, it widened my horizons but it also started me down the slippery slope. I started with careful soldering and decided to move to hot air soldering. And I could really do with a microscope to lend a helping hand.


Hot Air Setup - HDMI Microscope, Atten 858D+ Hot Air Station

The whole thing was triggered when I had to solder ESP modules on to a PCB. Most chips like SOIC were OK. I did not have to deal with TSSOP or TQFP. I stick to 1206 passive components, going down to 0805 only if necessary. I did try soldering the ESP modules by hand but the results were abysmal. Time to go down the hot air route...

Monday, August 29, 2022

YA$1µC - Yet Another $1 Microcontroller

I designed my servo controller around the PIC 16F18326. Then on the Element14 site, I see the dreaded words – Available for back order, Awaiting Delivery by 7/08/23! It is not often that calculating the wait involve the year. On the other hand, ESP based modules are an ebay/aliexpress click away. So I decided to redesign my circuit around the ESP chipset. Which brings me to the well known The Amazing $1 Microcontroller article. So how do the ESP chips stack up as an Amazing $1 µC?

ESP8285 bare chips, ESP-01F modules and breakout boards for it

Most ESP chips need an external flash chip. The exception is the ESP8285 that requires just an external crystal. So this is the chip that participates in this competition. To start with, is it really a $1 uC? Not really. It is basically a wifi chip, so it does need an external crystal. In quantities of 10, the ESP8285 bare chip is available on Aliexpress for under US$0.80. An external crystal adds about 12 cents – this is just under the $1 limit. So let us persevere and take a quick look at how it rates.

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.