Tag Archives: HackADay

Power line comms with an ATmega168 MCU

The average residence or business likely has a number of devices that piggyback on mains line for communication. 

Recently, Haris Andrianakis decided to design his very own power line communication system for a thesis project at the Technological Education Institute of Piraeus in Greece.

As HackADay’s Eric Evenchick explains, the basic principle of the system is to inject a signal onto the power lines at a significantly higher frequency than the 50 or 60 Hz of the AC power itself.

“Using both active and passive filters, the signal can be separated from the AC power and decoded. This system uses frequency-shift keying to encode data,” he says. 

”This part is done by a ST7540 modem that’s designed for power line applications. The modem is controlled over SPI by an ATmega168 microcontroller.”

Comms between the ST7540 modem could have also been established using UART (asynchronous), although as we noted above, Andrianakis chose SPI to establish a synchronous connection.

“After a lot of hours of SPI debugging using logic analyzer and testing different combinations I found an unusual but working method. In order to enable the Slave’s (ATmega168) SS pin to indicate SPI’s start/stop I used another pin of the same MCU and not one of the ST7540 (while it wasn’t included),” Andrianakis wrote on the project’s official page.

“So by checking the CD_PD line (carrier frequency detect line) of the ST7540 the MCU knows when there are available data for reception in ST7540. If the MCU detect available data enables the SS pin and the SPI communication starts by receiving the available data. When the data reception ends thus the CD_PD pin has changed state to indicate that there are no more available data the MCU restores the SS pin to its initial state disabling the SPI and clearing the SPI bit counter used to synchronize the communication.”

Essentially, says Andrianakis, this method is like deceiving the SPI while the same (Slave) device enables its SS pin.

Interested in learning more? You can download the source code/ schematics here and check out the project’s official page here.

Designing an Arduino-based Dahlander switch

Jean-Noel was fixing a broken Lurem woodworking machine equipped with a three-phase Dahlander motor. The trio of operation modes originally included: stop, half speed and full speed.

As HackADay’s Eric Evenchick notes, the motor uses a special mechanical switch to select the operating mode. However, the mechanical components inside the switch were broken, preventing the motor from being activated.

How to solve the problem without sourcing a new switch?

 Well, Jean-Noel decided to build his own Atmel-based, Arduino Pro Mini (ATmega328 MCU) powered Dahlander switch consisting of three relays tasked with selecting the wiring configuration for each speed mode.

Jean-Noel also added a button to toggle settings, along with two lamps to indicate what mode the motor is currently operating in.

“The Arduino runs a finite-state machine (FSM), ensuring that the device transitions through the modes in the correct order,” Evenchick explained.

“This is quite important, since the motor could be damaged if certain restrictions aren’t followed.”

Meanwhile, the state machine graph was generated using Fizzim, with the final product housed in a DIN rail case, allowing it to be securely mounted along with the rest of the wiring.

Interested in learning more about the Arduino-based Dahlander switch? You can check out the project’s official HackADay page here.

Uno power this two-axis solar tracker

Back in 2011, Jay Doscher had his power unexpectedly cut for 12 hours. After dealing with a refrigerator full of spoiled food, flashlights with dead batteries and a lack of candles, Doscher decided he needed to be better prepared for the next time the electricity went out.

His goal? To build a fully automated, portable solar tracking unit capable of automatically following the sun to optimize solar collection for those inevitable off-the-grid days.

As HackADay’s James Hobson notes, two-axis solar tracking units can help increase daily output by approximately 30%.

“Doscher’s makes use of a 12V gear reduced motor to provide panning and a linear actuator with positional tracking to control the tilt. To track the sun he’s got a digital compass and an Adafruit Ultimate GPS breakout board,” Hobson explained.

“To control it all he’s using is an [Atmel-powered] Arduino Uno (ATmega328 MCU). It’s a very slick and well engineered system and [Jay’s] hoping to spread it around the world — the entire thing is open source.”

Interested in learning more? You can check out Doscher’s tracker build log here and the relevant files on his GitHub repository here.

Building a modular infrared thermometer 


Brian McEvoy has created a unique Arduino-based modular infrared thermometer.

According to McEvoy, ESPeri.IRBud allows users to “associate an audible tone with a temperature from an infrared, contactless thermometer.”

Key project components include:

  • Arduino Pro Mini (ATmega168)
  • USB FTDI interface adapter
  • Melexis thermometer
  • 4.7K pull-up resistors
  • Cord from a stereo headphone with microphone
  • 3.5mm TRRS plug
  • 3.5mm stereo plug
  • 2.5mm stereo plug
  • 3 or 4 postion DIP switches
  • Logarithmic potentiometer
  • Enclosure

“The [Atmel-based] Arduino is the head and heart of the project. Everything connects to it one way or another. This project was intended to be very modular.  Everything can be unplugged and swapped for a different version,” he explained in a recent blog post.

“So instead of being stuck with a pair of cheap headphones you may plug in your favorite pair. If you decide to build this one on the cheap and upgrade to a better thermometer later you just solder up the brand new thermometer and plug it in.”

In addition, the IRBud can be easily modded for a wide variety of applications simply by attaching different externals.

“[For example], a wrist-mounted temperature sensor with a vibrator would allow a person to feel surface temperatures before touching them,” he added.

“That could be a huge safety boon. A shoulder mounted unit with a pressure asserting solenoid could allow wait-staff to sense when a patron’s coffee is cold or soda is warm. So far, I haven’t thought of a bad way to implement this.”

Interested in learning more? You can check out HackADay’s write up here and Brian’s official project page here.

Video: AVR raves modded Prophet synth

Atmel microcontrollers (MCUs) have tipped up in a number of synthesizer projects over the past few months including the ATmega328 synth kit and the Atmegatron (8-bit mono).

Today, we’re going to be taking a close look at a recent AVR hack by “Gligli” that skillfully recreates the Prophet 600 – which also just happens to be the world’s very first MIDI synthesizer.

Indeed, at the January, 1983 NAMM convention, the 600 was successfully linked with a Roland Jupiter-6 synthesizer in the first public demonstration of the MIDI protocol. According to Wikipedia, the link was facilitated by a MidiMate hardware interface and MidiTrack program, both developed by Moore and his partner, Paul Rother.

Image Credit: Wikipedia

As the original 600 was powered by a Zilog Z80 microprocessor that controlled modular analog voice chips, Gligli soon discovered that most of the synthesizer’s limitations in the 600 were due to the processor. After creating a PC-based emulator to better acquaint himself with the circuits, Gligli bought a used Prophet and started hacking.

“The [AVR-based] Teensy++ 2.0 (AT90USB1286) required a few hardware mods to fill the Z80’s shoes, including cutting off a pin and adding a few jumper wires. We really like the fact that no changes to the Prophet 600 itself were required,” explained HackADay’s Adam Fabio.

“Pull out the Teensy++, drop in the Z80, and you’re ready to party like it’s 1982 again,. The new processor interfaces directly with the Z80’s 8-bit bus. Since the AVR on the Teensy has built-in RAM and ROM, it simply ignores the ROM and RAM address spaces of the original system.”

Of course, interfacing a fast micro with older parts like an 8253 timer and a 68B50 UART does require some tweaking. More specifically, the system bus has to run slow enough not to violate timing requirements of various peripheral chips. As such, Gligli added wait statements to the upgraded firmware.

“Once the system was working, Gligli was free to start adding new features. He began by smoothing out the stepped envelope and filter generators, as well as adding new exponential modes,” said Fabio.

“From there he added new keyboard polyphony modes as well as pitch and mod wheel changes. Since this is an open source project, adding a feature is as simple as cracking open your favorite editor and writing it up.”

Interested in learning more? You can check out all the relevant project files on GitHub here.

Video: Building a smart cocktail shaker

Adafruit’s Tony DiCola has created a smart cocktail shaker capable of dispensing classy drinks with nothing less than accurate precision.

“The smart cocktail shaker is a project to help you easily mix drinks using an Arduino, a load cell from a cheap kitchen scale and an Android application,” DiCola explained in a detailed Adafruit tutorial.

“By measuring the weight of a cocktail shaker, an Arduino can send the amount of poured liquid to an Android application over a USB or bluetooth connection in real time. Making a drink is as easy as following the steps on screen – no more guessing or fumbling with measurements.”

As HackADay’s Brian Benchoff notes, DiCola connected a INA125 instrument amplifier to the load cell, instead of trying to interface with the electronics in the scale.

“[Meanwhile] an [Atmel-based] Arduino Micro (ATmega32u4) measures the weight on the load cell… With the known densities of gin, vermouth and Kahlua, Tony can get a very good idea of how much liquid is in the cocktail shaker.”

On the software side, Tony wrote an Android app for his tablet that communicates with the Arduino via Adafruit’s Bluefruit adapter.

“The app receives the current weight on the load cell, displays the current amount of liquor in the cocktail shaker and provides step-by-step instructions for making any cocktail,” Benchoff added.

Interested in learning more? You can check out Adafruit’s detailed build tutorial here.

Tannin is a DIY MIDI controller



Last week, Bits & Pieces got up close and personal with the Atmegatron, an 8-bit mono synth powered by Atmel’s ATmega328P microcontroller (MCU).

Today, we’re going to be taking a closer look at the Tannin, a DIY MIDI controller built around the Atmel-based Arduino Nano (ATmega328). 

Deisgned by Shantea, the system is equipped with 16 potentiometers, 19 buttons and four LEDs controller.

“It fully supports MIDI Note On/Off and CC messages, including the MIDI In (I’m using that feature in Traktor to control LEDs and set modifiers). It even features experimental MIDI Clock In support,” Shantea explained in a recent HackADay Project post.

“I’ve set it in a way that LEDs blink in sync with that clock, but there’s more work to be done to make it work fully. The buttons also have built-in feature of long press, that is, if you press button for half second (that can easily be defined) it will send another MIDI Note On on another channel (2, regular presses are sent on channel 1). The pots as well send MIDI Note On/Off messages, 6 per pot, depending on their position, with CC messages, of course.”

On the software side, Shantea used The Hairless MIDI to Serial Bridge, routing the messages via virtual MIDI cable software (loopBe30).

“When you match your virtual port in hairless-midi software, the once-serial messages from Arduino will become MIDI messages routed over virtual MIDI cable,” he said. “After that you can easily map your controller to any software which supports MIDI learn.”

In terms of hardware specifics, Tannin’s faceplate is manufactured out of a special plastic board 1.5mm thick (glued to 3mm plexiglas) and houses three PCBs designed in Eagle.

“Two for two groups of potentiometers to get really stable values (I used to connect the pots with wires which often resulted in gibberish values), and they both use ground planes on both sides,” Shantea added. “[Meanwhile], the main PCB [is fitted with the Atmel-based] Arduino, with connectors for two PCBs for pots. Each pot PCB has 4051 chip on it to read potentiometers. Buttons and LEDs [are] connected in a matrix with shared columns.”

Interested in learning more? You can check out HackADay’s introductory blog post here and the project’s official HackADay page here.

An AVR-based public transport display

When it is reliable, public transportation is almost certainly the way to go, especially for those who are environmentally conscious. 

Take Adrian and Obelix, for example. These two university students recently hacked an LED dot matrix display to show arrival times for stops near their dorm.



The duo found the display for the project, albeit with a defective controller, on eBay. However, Adrian and Obelix quickly swapped out the controller for a trusty AVR-based ATmega328P microcontroller (MCU) and TP-Link MR3020.

“The ATmega328P does all the hard work pushing every line into the registers of the display and multiplexing, [while] the MR3020 takes care of network communication where it’s wireless interface comes in handy, because you only need to provide power to the display,” the two explained in a detailed blog post.

“For now, a PC takes care of collecting all information and rendering an image, but this will eventually be done by the MR3020 in the future. For now, it’s more practical to do the rendering on a PC with Python, where later on a C-program would do all the work on the MR3020.”

It should probably be noted that the above-mentioned display actually comprises two separate displays – each with a resolution of 128*16 pixels. Indeed, each line is connected to a binary decoder.

“Both displays have a common line select, clock pin, enable and latch, but separate data pins and data output pins, so we connected the first dataout to the second and get a virtual 256*16 pixel display,” the two added.

Interested in learning more? You can check out HackADay’s write up here and the project’s official page here.

Atmel’s IoT SmartConnect is on HackADay

Atmel recently expanded its wireless product portfolio with a new family of solutions targeting the rapidly evolving Internet of Things (IoT).

Essentially, the new SmartConnect family combines Atmel’s ultra-low power MCUs with its wireless solutions and complementary software into a single package, allowing designers to easily add wireless connectivity to any embedded system. This new lineup includes Atmel’s SmartConnect Wi-Fi modules, an integration of the company’s ultra-low power Wi-Fi System-on-Chip with a Cortex M0+ ARM-based MCU, and the SmartConnect ZigBee SAM R21, a single-chip integrating Atmel’s ultra-low power ZigBee solution with a Cortex-M0+-based MCU.

Earlier this week, HackADay’s Eric Evenchick talked with Atmel reps about the new SmartConnect family. In his subsequent coverage, EvenChick wrote:

“SmartConnect moves beyond the point-to-point nature of WiFi Direct, and enables connections to standard access points. The SmartConnect series is designed for embedding in low cost devices that need to connect to a network… The first devices in the SmartConnect line will be modules based on two chips: an Atmel SAMD21 Cortex-M0+ microcontroller and an Ozmo 3000 WiFi System on Chip. There’s also an on-board antenna and RF shielding can. It’s a drop in WiFi module, which is certified by the FCC. You can hook up your microcontroller to this device over SPI, and have a fully certified design that supports WiFi.”

As Evenchick notes, there are two ways to use the module.

“The first is as an add-on, which is similar to existing modules. A host microcontroller communicates with the module over SPI and utilizes its command set. The second method uses the module as a standalone device, with application code running on the internal SAMD21 microcontroller,” he explained.

“Atmel has said that the standalone option will only be available on a case to case basis, but we’re hoping this opens up to everyone. If the Arduino toolchain could target this microcontroller, it could be a great development platform for cheap WiFi devices.”

Evenchick also pointed out that there are some notable differences between Atmel’s WiFi module and other platforms on the market.

“One major feature is the built in support for TLS and HTTPS, which makes it easier to build devices with secure connections. This is critical when deploying devices that are connected over the Internet. [Plus], Atmel [announced] improvements in power management as well,” he continued.

“The module can run straight from a battery at 1.8 V to 3.3 V without external regulation, and has a deep sleep current of 5 nA. Obviously the operating power will be much higher, but this will greatly assist devices that sporadically connect to the internet. SmartConnect is targeting a launch date of June 15, so we hope to learn more this summer.”

Interested in reading more about Atmel’s SmartConnect lineup? You can check out HackADay’s full write up here and our original Bits & Pieces SmartConnect article here.

Arduboy is an uber-mini game console



A Maker by the name of Kevin has created an uber-mini handheld game console using Atmel’s ATmega328p microcontroller (MCU).

As HackADay’s Brian Benchoff notes, the Arduboy build utilizes a number of unique design techniques.

“The inspiration for this project began when [Kevin] dropped an SMD resistor into a drill hole on a PCB. This resistor fell right through the hole, giving him the idea creating a PCB with milled cutouts made to fit SMD components,” Benchoff explained.

“With a little experimentation, [Kevin] found he could fit a TQFP32 ATmega328p MCU in the Arduino – in a custom square cutout. [Additional] components – including a CR2016 battery and OLED display- use the same trick. The rest of the design involved taking Adafruit and Sparkfun breakout boards, modifying the individual circuits until something broke.”

Kevin’s unconventional PCB design approach ultimately resulted in a handheld game console that measures only 1.6 millimeters thick – and boasts capacitive touch sensors for controls.

So what’s next for the Arduboy? Well, Kevin says he wants to release the design files and source code under a fully open source license and launch a crowd sourcing campaign.

“I also would like to sell [Arduboy] kits on my site and on Tindie,” Kevin wrote on the project’s page.

“[Plus], I would like to design the board with four layers and place the circuit traces entirely on the board interior. This would allow for test points to be placed in standard ISCP and FTDI configuration, eliminating the need for an otherwise custom bed-of-nails programming interface.”

Interested in learning more about the Arduboy? You can check out the project’s official site here.