Optimizing your electronics projects with a camera

What do you do when you have a microcontroller you’re trying to optimize? One method is using a debugger, but for AVRs and such that’s not a very common technique. For lower-level electronics projects, it’s nearly impossible, even. [Cnlohr] built a small Minecraft server that listens to in-game redstone circuits, but the performance of his real-world to block-world bridge wasn’t what he hoped. He came up with a pretty clever way of figuring out what was slowing his server down without any special gear at all.

[cnlohr]’s Minecraft server is just a simple AVR microcontroller, Ethernet adapter, and SD card affixed to a beautiful glass PCB. The performance of his server wasn’t what he expected; downloading a largish file from the server resulted in a download rate of about 55kbps, much slower than he expected. He wasn’t quite sure what the hangup was, so he took a camera and with a long exposure time took a very blurry picture.

The Minecraft server has a blue LED to show when the SD card was being accessed. In the picture above, [cnlohr] saw that SD card access was taking far too long, and if he wanted to optimize the code this would be the place to start.

Not bad for a dead-simple method of seeing where the code on your microcontroller project is slowing down.

Continue reading “Optimizing your electronics projects with a camera”

Behind the scenes of a 1K graphics demo

Programmer/designer [Steven Wittens] has posted a fantastic write-up on the black art of producing compact demo code, dissecting his own entry in the 1K JavaScript Demo Contest. The goal is to produce the best JavaScript demo that can be expressed in 1024 characters or less and works reliably across all standards-compliant web browsers.

[Wittens] details several techniques for creating a lot of visual flash in very few bytes, including the use of procedural graphics rather than fixed datasets, exploiting prime numbers to avoid obvious repetitions in movement, and strategically fudging formulas to save space while adding visual interest. These methods are just as applicable to other memory-constrained situations, not just JavaScript — some of the contest entries bear a resemblance to the compact microcontroller demos we’ve previously showcased, except running in your browser window.

The contest runs through September 10th, allowing ample time to come up with something even more clever. Whether he wins or not, we think [Steven] deserves special merit on account of having one of the most stylish blogs in recent memory!