Daily Archives: 6/2/2015

How much time is spent refreshing my 8 digit LED display?

A couple of days ago, I wrote about experimenting with a little Chinese 8 digit, 7 segment LED module that is driven by some 74HC595 shift registers. My initial experiment in driving it with the Teensy was successful: I got a nice, steady display with a simple interrupt driven scheme which displays each digit for two milliseconds before moving on to the next. But I wondered what percentage of my total time was actually being spent refreshing this display. In particular, how fast was the interrupt routine?

Most of the time spent in the interrupt routine is presumably spent in serially clocking out the individual bits to the shift register, using the Arduino library function shiftOut. I thought about adding some timers and computing what the time left, but this morning, I realized that I could use my nifty Rigol scope to figure out how long it took, by looking at the LATCH signal. Before clocking the data, the LATCH signal is brought low, and then afterwards brought high again. There are a couple of instructions on either side, but it’s not a bad approximation.

When I got home, I hooked up the scope.

NewFile2

Nifty! The total time accounts for 40 microseconds out of every 2000 microseconds, or about 2% of the total runtime for the Teensy. Nice! Works great. My guess is that it would be significantly more as a percentage with a traditional Uno. Perhaps I’ll try that out soon.

Addendum: I installed the same code on the Sparkfun Redboard (an Arduino Uno clone, which is an ATMEGA328 running at 16Mhz). With identical code, I used the same setup. The interrupt routine runs in about 360us, about 9x slower, consuming about 18% of the available CPU cycles. If you double the period to 4ms, you could halve this, but I find that the strobing of the ~33hz display to be slightly too much for me.

Modulo: A simple, modular solution for building electronics

A former colleague of mine, Erin Tomson, has been running a kickstarter that I’ve been meaning to talk about, but here it is, only a couple hours before the end of it, and she’s currently $382 short of her $50,000 stretch goal, and I haven’t written anything here. Sorry Erin! Anyway, I think of Modulo as what shields for the Arduino should have been: a cool way to plug a bunch of different controllers, sensors and display modules together to prototype or build electronic circuits. I had a great discussion with Erin at the Bay Area Makefaire just a few weeks ago, and it seems like a cool system. I think the system will be especially good for education. Even computers like the Raspberry Pi, which are nominally built for education don’t make the construction of additional circuitry and sensors particularly easy. This can definitely be a stepping stone to tinkering with computing as it relates to the physical world. I pledged in at the “Tea Time, Spark Edition” level, and am looking forward to testing it out.



If you’d like to get it on this, surf over and pledge. It’s a cool gadget, and it puts an engineer one step closer to doing other great cool stuff!

The Modulo.co website
The KickStarter page

Update: Whoohoo! She made her stretch goal! Congratulations, Erin!

More flying, with a couple of close mishaps…

I’m getting more confident flying the DJI Phantom 2, which means that I’m closer to having my first crash as I try to do more aggressive things. Mind you, the Phantom 2 pretty much has training wheels on it: no matter how hard you lean the stick to one side or the other, the copter will actually not doing anything blindly stupid. But still, immediately after launch, I flew across our soccer field and came closer to hitting the trees on the other side than I normally would like. After that, I just tried to do a bit of flying, doing overpasses of my head, trying to get used to turning left and right with the copter facing me and away from me… in general, just getting used to flying.

I did a couple of fun things: got a view of the 6′ tall seagull on top of one of our buildings, and a high angle shot of the main building here.



I did have one issue on this flight that’s hard to see: toward the end, I appeared to lose contact, and the copter took off to its “home location”, wherever that may be, but seemed to be toward our parking lot. A few seconds later, I managed to get control again and brought it back and landed without incident. Still, I should RTFM about how to set and recover from such an occurrence.