The Micro Word Clock 2021 Edition

I am planning on teaching some people to use kicad, since its my new favorite EDA tool. I searched high and low for a decent circuit that would do something cool, with a good variety (but small number) of parts. Basically something fun and not intimidating. I got hooked on formatc1702’s micro word clock. It is an excellent use of the atmega8 series unusually high current drive outputs.


left- original gyxm-778 matrix. Right adafruits luckylight KWM-20882CVB matrix

The one catch was that I had a lot of trouble finding the GYXM-788ASR LED matrix called for in the bill of materials. Fortunately adafruit sells a similar 8×8 matrix from luckylight. I tried to design around this by including both footprints, but I ended up mostly making a mess (and I still couldn’t find the 788!). Both are common cathode but the row/column nomenclature is flipped. To formatc’s credit, they did a good job with the firmware. It was easy to find pindefs.h, which let me swap around pins until I was happy. My strategy was to create a test pattern and make sure it shows up where you want it on the matrix. This was much faster than tracing every signal and creating the right pin definition the first time.

The second catch was that after programming, I couldn’t get the time to change! After glossing over the code it seemed like this must have something to do with the RTC- and after some gentle probing/touching the board it would occasionally work. Initially I attributed this to the crystal not starting up, but after many power cycles and other pokes, it seemed like the crystal would actually run just fine. As a last resort I read the datasheet, and lo and behold, the Vbat pin needed to be grounded.

I bridged these two pins

A blob of solder quickly remedied this deficiency in my pcb, and afterwards changing the time worked just fine. I suspect that sometimes the chip “just works” if that pad happens to be at the right potential on reset, but sometimes it doesn’t. The button presses update the RTC time, not a time on the micro. So if the RTC does not start up, then you can’t change the time.

Other Notes

Pin1…probably. I prefer a dot!

I used the default footprints from kicad for a lot of the parts, and the pin 1 designators are a little wishy-washy. They look more like an printing error than a clear indicator for pin 1. I guess I will get used to it instead of re-creating every part from scratch, but if I only have a few parts, throwing a dot on the PCB would go a long way during assembly.

I should have also added a polarity marking on the power connector, and a couple of i2c test points wouldnt have hurt either. Since this was a quick board just for me and the parts are big, I didn’t worry about it.

Upgrades for V2

I figured if I was going to do this board again, I may as well overdo it. I managed to cram everything into a board roughly the same size as the matrix itself, even after I added a coin cell and a USB connector for 5V power. The coin cell will keep the RTC running for about 10 years, even if it loses usb power. This way I can program it, ship it to someone, and they can just plug it in and the RTC will know what time it is. The ground plane is far from perfect but its about as good as I will get with a board this size

Since the time will basically never need resetting, the switch for changing the time is very very small. I used the NanoT switch which is about the same size as an 0805, which is very very small indeed. And because programming is now a one-time affair, I moved the programming header to castellated vias/PTH on the edge of the board. They .1″ pitch so they should be easy to solder to headers if I cant scare up a pogo pin jig for them. For some reason the ground pad shows an air wire. The 5V is purposely left floating since I don’t care about that connection.


The git repo can be found here. Its probably not ready for prime time yet, but check the readme. I will update that when its reproducible.

My Chorded Keyboard Vision

I am building a one handed chorded keyboard, which is exactly what it sounds like.  It is a keyboard, but instead of using the qwerty layout, it uses chords of keys as input.

The main reason I want to build a one handed chorded keyboard is because it would be convenient.  A few of the advantages I see are that it will be smaller, cheaper, and will reduce the amount of devices that I use to interact with my computer.

Lets look at a typical interaction with my laptop, which is my primary computer (my other computer is my phone).  I have 6 input devices to choose from.  They are:

  • built-in trackpad
  • built-in nub mouse
  • built in nub mouse keys
  • built in trackpad mouse keys
  • tray-style keyboard
  • logitech mouse (wireless)

my laptop interface

This is already looking bad.  First off, there is a triple redundancy in the pointer category.  second, the nub is useless as a normal pointer, because its left button is underneath my left thumb when my left hand is on the home row.  the nub mouse buttons are also extra-super-hard to push, so you don’t accidentally push them with your thumb.  The trackpad has a similar problem in that it is crammed in there near the spacebar, and sometimes it gets pressed by my thumb and does weird stuff.  To add insult to injury, the keys are huge dust collectors, and can jam if they get a big enough piece of stuff in there, which happens frequently with little pieces of 26 gauge wire insulation which is just big enough to slip into the gaps.

On the other hand, the logitech mouse is a joy to use, provided you have a large flat surface to work on.  However, I prefer the logitech trackball mouse (m570), because you don’t need to move it at all and it is larger and more comfortable for my hand.  That said, the build quality of the m570 is sub par, and it feels kind of cheap-o.

So lets look at a pretty common workflow for solidworks.  I start out left hand on the keyboard, right hand on the mouse.  Thats great for clicking around, but eventually I need to enter a number.  Then the dreaded top-row numbers come into play.  lets say I need to enter “23.43”.  The “.” button is way over by my right hand, with the arrow keys, enter, and backspace.  So in order to enter something, I have to move my left hand across my body to those keys, which my left hand does not normally type on.  So instead, I end up moving my right hand to the keyboard, and then back to the mouse, and back and forth, and there are numkeys, and shifts and lot of moving.  it is particularly annoying because I need to do this over and over again in my workflow.

Now lets think about writing code.  Alpha characters are pretty awesome on the querty layout, but { } [ ] | : ; ” ‘ ( ) = + -* all require a lot of right-hand movement, and a lot of them involve holding down shift.  While this has become second nature to me now, I would gladly swap a few alpha characters for those keys.  Or even have a querty[]{};:'” keyboard, with more keys!  QUERTY was designed for typists on typewriters, not computers.

crazy busy desk

Crazy busy desk.  This is a real picture of what my desk looks like.

This is my final whiney paragraph for this post, but take a look at this picture.  This is a real, in-use picture of my desk.  Look how many keyboards are on this desk.  There are THREE.  two laptops, and an external keyboard because the netbook kb is too small, and too far away, but there is barely room for the external keyboard because of all the crap!  To mouse on either of these machines is also a pain, and it means I have my wrist unsupported on the right, or I have to reach over a tangle of wires on the left.  On top of it all, I was barely even using the computers- they were mainly just for datasheets or running scripts.

With a chorded keyboard, I will be able to put my laptop veeeery far away and control everything through a chorded keyboard and mouse combo.  Even if the keyboard is utterly crappy, and can only type 2 wpm, it will be plenty good for looking at datasheets, or goggling something while I am at the bench.

REVOBOTS 5/6: The end of the REVOBots Story

Students in REVOBots

For schematics and code, check out the revobots page here.  For video of the bot, look here.

Well folks, it is about time I wrapped up REVOBots, which turned out to be just as much work as expected; which is to say that it took more time and effort that I had planned.  And as expected, attendance dropped off towards the end of the semester as our project based classes go into full swing and spring (and the opportunity to lounge around outside) starts to warm up the weather.

REVOBots 5 ended up being an explanation about some code that I wrote, and an introduction to EagleCAD.  I have attached the code to the revobots 6 pdf because if fits in better there.

A student testing a ‘bot in the dark

REVOBots 6 was a build day dedicated to making the revobots go.  There were two critical failures on my part before revobots 6:

  • Did not spec out the motors/H-bridges properly.  The motors turn out to run at 3V, while the H bridges run at 5- ~30 V.
  • Did not order parts early enough

That said, the bots still work at 5 volts, albeit with a drastically shorter motor life.  But operating at 5V this seemed to cause too much of a current drain on the power supply, so we got some weird twitchy behavior during the class.  Since then I have developed a cheap fix using two 2n3906 NPN transistors, and a smattering of decoupling caps.

Top view of the ‘bot

What is a decoupling cap though?  Doesen’t the five dollar arduino already have them?

The answer to the second question is yes, but the cap was not big enough.  The problem the circuit was having was that the batteries were  trying to output a constant voltage.  This means that as current demands changed in the circuit, the battery had to adjust the output current.  With the microcontroller taking only a few miliamps, the circuit is not drawing much power.  BAM!  Motor turns on and what happens?  The battery needs to supply more current, but can’t.  Then the mcu shuts down as it looses power, sending a short pulse to the motor.  So bigger decoupling caps were needed to smooth out the power supply, which the caps do by charging up to 5V, and then discharging if the voltage drops due to sudden current demand.

So the symptoms were: mcu turning on and off, which I could tell because the status LED I had attached was flickering.

The prescribed cure was: Find all the capacitors on my floor, and stick them across the power rails.

Result:  REVOBot works!  Check it out here!  (In this video it is running away from light because I have the motors running in reverse).

REVOBOTS: Manny the Manual Line Following Robot

Manny, the manually operated robot

So the other day I got bored and prototyped something which I quite liked for revobots.  It might be to people advantage to see it here before revobots meets again in two weeks, so I thought I would do a post.

One might wonder what a manual robot is.  Well, thats what I am calling this.  It doesn’t have any actuators, so you have to move it around with your hand, but if you follow the instructions it gives you (via the LEDs) it will follow a line!

The pseudoalgorithm for this is that each sensor has some threshold so that it reports a status back- either light or dark.  If the middle sensor is dark, and the outer sensors are light, then light no LEDs.  If any sensor is not on the proper darkness, a corresponding LED is lit.  So if the left sensor strays onto the line, and the other two are off the line, then the middle and left sensor LEDs turn on, indicating the need for a right turn.

Oh no! Hard to port!

Soon I will have this mounted on a revobot chassis with power, then I will post a video and documentation!



REVOBOTS Week 4: Rebobot Factory

Robot Factory!

Videos: Part 1 Part 2

Guide: TSK4

Today AC113 was turned into an assembly line for pololus robot chassis kit.  The lecture today was about controlling big things with little things, with interrupts (which I thought was an important topic) thrown in in the context of encoders.  The turnout was a little below what it normally is, but still pretty good.  Word on the street is that the freshmen have a lot of stuff due this coming week, so there is a big crunch to get that done and therefore there are less REVONauts (as I call them).  Still, there was a good turnout.  Next time I would definitely teach the class in pairs of two to a robot, but one to an arduino.  I am afraid that there is going to be too much debugging of implementations of different robots/hardware that it will be hard to get to each student individually.  Working in teams raises the threshold for when people come to me, and it might actually increase the quality of the exercise for everyone so that people get more done.

Here are some shots of the assembly line:


Attendance was not too shabby

REVOBots Week 3: Halfway There

Another good turnout. Obviously, this is not a picture of everyone who attended…

Material for week 3:

Videos: Part 1 Part 2

Guide: TSK3

And by halfway there, I mean halfway done with REVOBOTS!  So far, we have built a $5 arduino clone, learned about several kinds of sensors, and finally, this week I (properly) showed them how to write code that runs on the clone.  I think it went well.  This class alleviated a lot of the previous frustrations people were having with the device as far as having hardware but not knowing how to use it.  By the end of class several people had actually managed to build a breakbeam sensor, which I thought was awesome.

Debug ALL the problems!

On the other hand, the actual devices that the students built are starting to show some wear and tear; often people have some trouble connecting them to their computer.  Often, the problem is that the USB cable had come unstuck from the header pins and needs to be resoldered, or the ground and power wires are touching (Which shuts off the USB port), or the usb cable came out of the breadboard and was plugged in backwards (D- and D+ swapped).  I think it might be worth my time in the future to cad up a board for these bootloaded atmega328s so that they are less likely to fall apart, or be put together wrong.

Inspiring student gets breakbeam sensor to work.

Despite the frustrations and the general roughness of the first pass at teaching revobots, I think it is worthwhile for both me and the students.  Hopefully I will teach this again soon, but better.

REVOBots: Getting Ready!

Custom SMD Attiny45 USBISP programmer doing its job!

Last night a small package from monoprice, and a huge box from pololu arrived.  In it were the materials for the REVOBots class I am going to teach.  Since the first class is this weekend, I really needed to finish the guide/handout!  I spent all night building a Tamaiya gearbox (pictorial instructions soon!), re-building a $5 arduino, and eventually fixing an attiny45 based usbisp programmer.  The git repo for the bootloader of the $5 arduino is here.  It took about 6 hours to finally get everything working.  There were several stumbling blocks, like the gearbox having 3-4 configurations, and a dead ATMega chip.  But when I finally got the arduino IDE to talk to the chip, it was worth it- it was much easier to sleep knowing that the parts coming in from digikey would work.  Anyways, the first REVOBots guide is posted now, in the downloads section, or with this link.  REVOBots are coming!

REVOBot 001

Secret Knowledge: REVObots

Recently, the leadershio of the REVO (Research on Electric Vehicles at Olin) club approached me and asked me to drop some secret knowledge on them.  While they have had some experience with EVs, they have no real EE background, and a very limited embedded/microcontroler background, and they wanted me to fix it.

Over the next few days I developed a 6-class course that would get their feet wet in the direction of building and understanding useful devices on an EV, or really any platform using a microcontroller, and even some that don’t (motor drivers and such).  I will be using the arduino platform for what it was intended; as a simple teaching platform.  The six classes are based around these learning goals:

  1. Explain what a mcu is, what it is good for, and what kind of hardware capabilities they have as far as PWM, ADC, timers and counters.  Explain what an arduino is, and build the secret knowledge arduino.
  2. Explain basic sensors that depend on resistance (thermistor, photoresistor) and current (photodiode) work.  Explain digital sensors, show an example with the 1-wire protocol.
  3. Explain various control schemes: on/off, proportional, differential, and integral.  Explain how to actually use them in hardware, using examples like the laser poejector.  Focus on quadrature encoding.
  4. Explain how to control big things like motors or AC current, with little things, like microcontrolers.  This will be all about BJT transistors, H-bridges, and relays.
  5. Explain how to talk to other devices via serial and USB.  This will be pretty theory-heavy, but we will have a USB example.
  6. Putting this all together, we will finish building a small robot and have it do some kind of task.

These six classes will be spread out over six weeks, and each will have both a lecture and a lab portion with a deliverable.  This is similar in structure to the other Secret Knowledge projects, but it differers in a few ways that will hopefully help deal with the problems of students not coming to classes, and students not retaining knowledge.

The difference here is that class is predictable.  Each week of TSK before was planned on the fly, materials were sourced from a withering stockroom, and everything had to be dirt cheap.  This made it hard to say what we would be doing from week to week.  The predictability makes it easy to know when to be where.  There is also a big carrot dangling at the end of six weeks when the students actually finish the robot; this will hopefully help eliminate the week-to-week variation of interest.

To help with the knowledge retrieval after the class is through, I will be putting together a guide ahead of time, with stuff people will learn each week.  Ideally, each deliverable will also be structured as a working example of the concepts covered in the class, and seeing everything work together will help cement the knowledge.  Most of the material will just be me throwing mud on a wall and hoping some sticks; the idea is that people will at least know where to start projects with mcus once this is all said and done.

I will be blogging more about this here as the class begins and things are done.  Classes will be recorded and posted on youtube.  In the Secret Knowledge tradition of flying-by-the-seat-of-ones-pants, and living on the gritty edge of barely being on time, right now I have a two week lead time before the class starts.  Better get going!

Laser Projector!

My team just finished our laser projector for Priciples Of Engineering, or POE at Olin.  Its pretty sweet-mostly its good at drawing circles, because it decided to shake itself apart.  We will probably fix it up before EXPO on Monday (Olin’s open house), but if you want to take a look at what we did, check out our website (here)!

I might add some more details later, if folks are interested.  However, right now I am going to bed.  As always, if there are questions, ask away.

Clock Project: Inspiration

A few weeks ago I went to the MIT Swapfest to poke around and look at the cool stuff that was there.  Naturally, I came back with a bag full of random crap including one very cool item:  A Durant Precision Counter.

The box!

I found it at one of the vendor tables outside.  It came in its original box with the original manual-complete with notes from the previous owner.  I really wondered why I was buying it.  I didn’t know if it would work, I didn’t know if it only ran on AC, and I didn’t really have a plan for it.  Not that I would expect any of that to stop me, because those thoughts have never stopped me from acquiring piles of crap.

A counter is just what it sounds like-it counts.  The display is kind of like a combination lock; there are four dials with the numbers 0-9 on them that rotate.  Each time the button is pressed it increments by one until it gets to 9999 and resets to 0000.  Normally, this is done completely mechanically, but this counter is way cooler than a mechanical one.  The mechanical linkage that increments the counter can also be actuated by an electromagnet!

The counter, sitting on the breadboard I am building the clock on

Anyways, I have to do something with it.  Four-digits of novel display-o-power.  Clicky.  Mechanical.  Cool.  Clearly I should turn it into a clock!