Embed With Elliot: Shifting Gears With AVR Microcontrollers

Most modern computers are able to dynamically adjust their operating frequency in order to save power when they’re not heavily used and provide instantaneous-seeming response when load increases. You might be surprised to hear that the lowly 8-bit AVR microcontrollers can also switch CPU-speed gears on the fly. In this edition of Embed with Elliot, we’ll dig into the AVR’s underappreciated CPU clock prescaler.

Continue reading “Embed With Elliot: Shifting Gears With AVR Microcontrollers”

Embed with Elliot: Multiplexing SPI Uses Few Pins

[Ralph Doncaster], aka Nerdralph, seems to be absolutely driven to see how few resources he can use on a microcontroller to get the job done. In this post on his blog, [Ralph] writes some custom bit-banged SPI code to cut the number of SPI lines necessary to drive an nRF24L01+ radio module from four down to two. That really helps if you’re using a micro with only six free pins, like an ATtiny85.

If you’re going to say, “why don’t you just buy a bigger microcontroller?”, you’re missing the point. This exercise strikes us as optimization for optimization’s sake and a dirty hack, both of which are points in its favor.  There are also a couple of techniques here for your mental toolbox. We thought it was interesting enough to look at in depth.

Continue reading “Embed with Elliot: Multiplexing SPI Uses Few Pins”

Hackaday Prize Entry : Impact – A Head Concussion Monitor

A lot of young athletes who get concussions each year go undiagnosed, leading to brain injury. [Hunter Scott] is working on a device called Impact to help detect these events early. According to this article which discusses the issue of concussion recognition and evaluation, “Early identification on the sports sideline of suspected concussion is critical because, in most cases, athletes who are immediately removed from contact or collision sports after suffering a concussion or other traumatic brain injury will recover without incident fairly quickly. If an athlete is allowed to keep playing, however, their recovery is likely to take longer, and they are at increased risk of long-term problems”

The device is a dime sized disk, which has an ATTiny85 microcontroller, memory to hold data, an accelerometer and a LED which gets activated when the preset impact threshold is breached, all driven by a coin cell. This small size allows it to be easily embedded in sports equipment such as helmets. At the end of a game, if the LED is blinking, the player is then screened for a concussion. For additional analysis, data stored on the on-board memory can be downloaded. This can be done by a pogo-pin based docking station, which is what [Hunter Scott] is still working on.

He’s having a functional problem that needs fixing. The ATTiny85 cannot be programmed with the accelerometer populated. He first needs to populate the ATTiny85, program it, and then populate the accelerometer. He’s working in fixing that, but if you have any suggestions, chime in on the comments below. We’d like to add that [Hunter] is a prolific hacker. His project, the Ultra-wideband radio module was a Hackaday Prize semi-finalist last year.

The 2015 Hackaday Prize is sponsored by:

Measuring Temperature On An AVR Without A Sensor

There are a few AVR microcontrollers with onboard temperature sensors. These temperature sensors are neither accurate nor precise, but they do work for a few use cases. [Thomas] came up with a little bit of code that runs on all AVR microcontrollers, and is at least as accurate as the sensors in the rare AVRs that have them.

Although not all AVRs have a temperature sensor, they do all have RC oscillators, and these RC oscillators are temperature sensitive. By combining the RC oscillator and watchdog timer, [Thomas]’ code can get a vague idea if it’s getting hotter or colder.

To prove his code works, [Thomas] took an ATtiny13A chip loaded up with a few bits of code and placed a heated coin on it. The chip was programmed to turn on an LED when it detected a rise in temperature, and predictably, the LED lit up. With a coin chilled in a bowl of ice water, another bit of code ran, flashing the LED.

While we’re sure it’s neither accurate nor precise, it does have its uses – overheating protection or a simple thermostat. You can check out a video of the code in action below.

Continue reading “Measuring Temperature On An AVR Without A Sensor”

Using an LED as a Simple RF Detector

When [b.kainka] set out to make the world’s simplest RF detector, he probably didn’t realize it would be as easy as it was. Consisting of only a handful of components and thirty eight lines of code, he was able to make an RF detector that works reasonably well.

The microcontroller running the code is an ATtiny13 on a Sparrow board. He’s using an everyday LED as a detector diode and an internal pull-up resistor in the ATtiny13 for the bias voltage. The antenna runs off the LED’s anode. To make it sensitive enough, he switches on the pull-up resistor for a tiny fraction of time. Because an LED can act like a small capacitor, this charges it to a few volts. He then switches the pullup off, and the voltage across the LED will start to discharge. If there is an RF signal present, the discharge voltage will be less than the discharge voltage with no signal present.  Neat stuff.

Be sure to check out his Hackaday.io page linked at the top for full source, schematics and some videos demonstrating his project.

Continue reading “Using an LED as a Simple RF Detector”

An Introduction to Clock Dividers and Psychological Warfare

A while ago, [nsayer] was inspired by a Hackaday post to build one of the most insidious means of psychological warfare. I speak, of course, of the [Lord Vetinari] clock, a clock that ticks at random intervals, but still keeps accurate time. His build, the Crazy Clock, is a small controller board for off-the-shelf clock movements that adds the [Vetinari] feature to any clock by soldering only a few wires.

The Crazy Clock is a pretty simple device consisting of only a 32.768 kHz crystal, a microcontroller, and a few transistors to pulse the movement of a clock mechanism. While psyops is great, it recently occurred to [nsayer] that this device could be used for other build.

Since the output of the Crazy Clock doesn’t necessarily have to be connected to a clock movement, [nsayer] decided to connect a LED, generating a 60Hz flashing light for a phonograph strobe. This is easy with timer prescalers and clock dividers; the original 32.768 kHz signal is divided by 8 to produce a clock that ticks every 4.096 kHz.  Divide that again by 120, and you get 34 2/15. Yes, this is all stuff you learned in fourth grade, and if you’re smarter than a third grader you can eventually whittle a 32.768 kHz clock down to a nice, round, binary number – exactly what you need for computing time.

[nsayer] posted a 240 fps (vertical) video of his Crazy Clock blinking at 60 Hz. You can see that below.

Continue reading “An Introduction to Clock Dividers and Psychological Warfare”

In Which Robots Fight the Console Wars

Though the names have changed over the years, the console wars wage on. [moop] must have been feeling nostalgic for the NES vs. SEGA days when he started his current project, Foobot, which is a tabletop football (soccer) game played by robots that are controlled with classic NES and SEGA controllers.

Each team has two robots that tool around on laser-cut perspex wheels attached directly to 16,000RPM motors. An SN754410 controls the motors, and each robot has an ATtiny2313 brain. They all communicate with a single transmitter over their 433MHz 1402 radio receiver modules. To avoid collisions, [moop] used a packet system, wherein each robot has an ID. The messages all contain a robot ID, message payload, and checksum. The robots ignore messages addressed to others, and any message with an invalid checksum.

[moop] has made everything available on his github, including the PCB layouts and CAD files for the robot chassis and transmitter case. Watch them battle it out after the break. If the Foobots have riled you up about vintage gaming, check out these sweet arcade hacks.

Continue reading “In Which Robots Fight the Console Wars”