Making The Case For In-circuit Debugging Tools

in_circuit_debugging_of_pic_microcontrollers

If you are in the market for a PIC microcontroller programmer, you may want to consider a model with an In-Circuit Debugger (ICD). [Rajendra] put together a great tutorial on using an ICD when debugging PIC firmware, which makes a pretty convincing argument for owning one.

In his tutorial, he happens to be using a MikroElektronika PICflash2, but he says that there are plenty of other ICDs out there if you are not keen on this particular model. The PICflash2 not only acts as an ICD, but as the name suggests it works as an ICSP as well.

[Rajendra] walks us through a short debugging session using some simple code that reads data from an LM34DZ temperature sensor, displaying the results on an LCD screen. While he isn’t actually hunting for bugs, he does show how easy it is to step through the PIC’s code one statement at a time, evaluating variables and registers along the way.

[Rajendra] does point out that using an ICD does occupy a few I/O pins while running, limiting your resources just a bit. We think that being able to debug code as it runs is pretty reasonable tradeoff if you don’t necessarily need each and every pin available for use.

AVR Programmer Modelled After The MkII – Uses LUFA

Here’s a new option for building your own AVR programmer. It’s called the MkII Slim and the diminutive size makes it live up to its name. The design is rather spartan, using just three chips; a voltage regulator, a MAX3002 level converter, and an Atmel AT90USB162 as the main microcontroller. This chip has a built-in USB module, foregoing the need for a separate FTDI chip.

The firmware is built on the Lightweight USB Framework for AVRs (LUFA). This is a USB stack implementation originally called MyUSB that was developed by [Dean Camera]. Regular lurkers over at the AVRfreaks forums will recognize [Dean’s] name, or his handle [abcminiuser] as a source for many of the high quality AVR tutorials found there. But we digress.

The programmer offers all the features you’d want in an In-System Programmer. It can easily be reflashed with future updates thanks to the bootloader running on the chip. There’s jumper-selectable power options, and it can program targets running at 3.3V or 5v. The full development package including code and artwork is available for download at the site linked above. For your convenience we’ve embedded the schematic after the break.

Continue reading “AVR Programmer Modelled After The MkII – Uses LUFA” →

USB Reddit Upvote/Downvote Button

reddit_upvote_downvote_button

[Chris] has recently become a self-declared Reddit addict and wanted to build something that would streamline the process of voting on posts. Inspired by the Awesome Button hack featured on Make a little while back, he thought that a physical upvote/downvote button would be the ideal peripheral for all of his Reddit needs.

He was a big fan of using the Reddit Enhancement Suite, which allows you to submit votes with a single keystroke. He combined this browser extension with a Teensy development board, and had his voting button prototyped in no time. Once he fine-tuned the Arduino sketch that he used to emulate the required keypresses, he got busy building a case for his creation.

He busted out his 3D printer and had a custom working project box in about 30 minutes. He printed arrows for the upvote and downvote buttons, snapped everything together, and then gave his quick vote box a spin. Everything worked perfectly, and he’s quite happy with his creation.

We imagine that our resident Reddit addict in chief is pretty jealous right about now…

Stick around if you’d like to see a time lapse video of the button’s creation.

Continue reading “USB Reddit Upvote/Downvote Button” →

RGB LED Spectrum Analyzer Coffee Table

rgb_led_spectrum_analyzer_coffee_table

This year, students working for Texas Instruments as part of their Co-op program were challenged to construct a project around the company’s MSP430 microcontroller. A team of three students, [Max Thrun, Mark Labbato, Ian Cathey] decided to build something that would fit perfectly in any college student’s dorm room – an RGB LED coffee table.

We’ve covered RGB LED tables in the past, but as far as we can tell this is the first MSP430 based unit we’ve seen. Microcontroller aside, the table features a lot of items that are considered “standard equipment” when it comes to these sorts of living room LED installations. The trio installed 128 RGB LEDs into their table, isolating each one using a wooden grid, and used some frosted glass to diffuse the display a bit.

What really makes this table stand out is the software. The team wrote an application that creates a Fast Fourier Transform of whatever music is being played, in order to find beats and generate real-time visualizations for their table. The result is a pleasing display that’s sure to be a hit at parties.

Check out the video below to see their creation in action.

Continue reading “RGB LED Spectrum Analyzer Coffee Table” →

Microcontroller Communications Using Flashing Lights

phototransistor_pc_microcontroller_communications

[Scott] was driving in the pouring rain behind a car with its blinkers on when inspiration struck. He had previously created a simple communications system using his sound card that allowed him to send data to a microcontroller from his PC, but he thought that doing the same thing with light would be an interesting exercise.

He decided that the best way to go about building such a system would be to use a phototransistor along with his computer monitor to send data to his microcontroller. While he couldn’t really think of any practical application for the project, that didn’t stop him from putting it together just for grins.

[Scott] says the circuit is dead-simple, and includes a pair of phototransistors along with their required resistors. The receiver was tied into the ADC of his microcontroller, where he was easily able to pick up some simple light patterns. His ultimate goal is to put together a javascript application that sends data to his microcontroller, though he’s looking for a bit of assistance on the programming side of things – any takers?

While [Scott] couldn’t come up with any applications off the top of his head, we know of at least one. Anyone familiar with the Bloomberg financial application will likely have come across their “B-Unit”. This piece of hardware is about the size of a credit card, but thicker. Armed with a fingerprint scanner and a photodiode, it reads a series of flashing lights from your computer screen in order to ‘synchronize’ the unit for each login session that is not initiated with an official Bloomberg keyboard. So there’s one for you!

Continue reading to see a video of the system in action.

Continue reading “Microcontroller Communications Using Flashing Lights” →

A Study In AVR Power Saving Techniques

amtel_avr

[Scott] found the iCufflinks from Adafruit Industries pretty interesting, but he thought that the stated run time of 24 hours was a bit short. He figured he could improve the product’s power consumption at least a little bit, to improve the overall battery life.

From their schematics, he placed an order for parts and built two identical iCufflink mock-ups side by side – one running their code and one running his. He took baseline current draw measurements, then got busy slimming down the cufflinks’ software. It had been 20 years since he touched assembly, and he has never written it for an AVR, but judging by his work he’s not rusty in the least.

He slowed the ATtiny’s clock down and tweaked a few other settings for a savings of 53μA, but the real improvements came via a fairly simple fix. The original code called for the processor to institute a counting loop to sleep, which he found to be very wasteful. Instead, he chose to put the processor in an idle state, using the chip’s watchdog timer to wake it when it was time to pulse the LED. The power savings from this change alone was a whopping 261μA!

When he was said and done, the changes save about 315μA of current draw, and should allow the cufflinks to run for up to 38 hours without swapping batteries. In [Scott’s] opinion, a nearly 60% improvement in battery life is pretty good for a day’s work, and we’re inclined to agree.

Understanding Interrupts In PIC Microcontrollers

Interrupts are the name of the game for more functional microcontroller firmware. [Rajendra] just posted a tutorial covering all of the interrupt types for the PIC 16F688 microcontroller. He gives an overview of all of the major points: what an interrupt is, what causes interrupts, how to read the datasheet (often overlooked) to set up interrupts, and finally he applies it to a test platform and a bit of code.

We’ve been playing around with an Arduino again over the weekend and are a bit frustrated with the restricted access to interrupts. That issue deals with AVR interrupts, a topic with which we’re already well acquainted. But we work with PIC hardware much less often and it’s fun to explore how the other half does things, both in hardware and in code.