Simple USB Power Meter

The USB interface is being increasingly used as a power supply and charging port for all kinds of devices, besides data transfer. A meter to measure the electrical parameters of devices connected to a USB socket or charger would be handy on any hacker workbench. The folks at [electro-labs] designed this simple USB power meter which does just that.

The device measures voltage and current and displays them, along with the calculated power, on the small 0.5″ OLED display. The circuit is built around an ATmega328. To keep the board size small, and reduce component count, the microcontroller is run off its internal 8MHz clock. A low-resistance shunt provides current sensing which is amplified by the LT6106 a high side current sense amplifier before being fed to the 10 bit analog port of the ATmega. A MCP1525 precision voltage reference provides 2.5V to the Analog reference pin of the microcontroller, resulting in a 2.44mV resolution. Voltage measurement is via a resistive divider that has a range of up to 6V. An Arduino sketch reads voltage and current data on the analog ports and displays measurements on the display. The measured data is averaged to filter out noise.

The OLED display has a SPI interface and requires the u8glib library. The project uses all SMD parts, but is fairly easy to assemble by hand and could be a nice starter project if you want to wet your feet on surface mount assembly techniques. It’s designed using SolaPCB EDA software, and the source files for schematic and board layout are available as a ZIP archive. Download the BoM and Arduino code and you have everything needed to build this nifty device.

Thanks to [Abdulgafur] for sending in this tip. And if you are looking for a more comprehensive solution, check the awesome Friedcircuits USB Tester which we reviewed earlier and is available in the Hackaday Store.

An Apple ][ emulator on an Arduino Uno

April Fools’ Day may have passed, but we really had to check the calendar on this hack. [Damian Peckett] has implemented an Apple ][, its 6502 processor, and a cassette port, all on an Arduino Uno. If that wasn’t enough, he also uses a PS/2 keyboard for input and outputs analog VGA. [Damian] is doing all this with very few additional components. A couple of resistors, a capacitor and some very clever hacking were all [Damian] needed to convince an Arduino Uno that it was an Apple.

Making all this work boiled down to a case of resource management. The original Apple ][ had 4KB of RAM and 8KB of ROM. The ATmega328 has only 2KB of RAM, but 32KB of Flash. The only way to make this hack work would be to keep as much of the emulation and other routines in Flash, using as little RAM as possible.

The core of this hack starts with the MOS 6502, the processor used in the Apple. [Damian] wrote a simple assembler which translates the 6502 opcodes and address modes to instructions which can be executed by the Arduino’s ATmega328. To keep everything in ROM and make the emulator portable, [Damian] used two large switch statements. One for address modes, and a 352 line switch statement for the opcodes themselves.

A CPU alone is not an Apple though. [Damian] still needed input, output, and the ROM which made the Apple so special. Input was through a PS/2 keyboard. The PS/2 synchronous serial clock is easy to interface with an Arduino. Output was through a custom VGA implementation, which is a hack all its own. [Damian] used the lowly ATmega16u2 to generate the video timing. The 16u2 is normally used as the Arduino Uno’s USB interface. The only external hardware needed is a single 120 ohm resistor.

The original Apples had cassette and speaker interfaces. So does this emulated Apple. [Woz’s] original cassette and speaker interface accurate loops to generate and measure frequencies. One of the trade-offs [Damian] accepted in his 6502 was cycle accuracy, so he couldn’t use the original routines. Not a problem though, as he was able to write simple functions to replace these routines and drop them in place of the Apple’s own ROM calls.

The Apple ][ ROM itself is handled as one giant character array. This includes the system monitor, Mini-Assembler, Sweet-16, and [Woz’s] own Integer Basic. [Damian] caps off this incredible project by booting his new computer, loading a  Mandelbrot set program from cassette -or in this case an audio file stored on his cell phone, and running it. The well-known fractal is displayed in all its glory on a modern LCD monitor, driven by a microcontroller, emulating a computer from nearly 40 years ago.

Continue reading “An Apple ][ emulator on an Arduino Uno”

Automatic Garage Door Opener Works for Your Cat

Using an Arduino or Raspberry Pi to perform a task in the real world is certainly a project we’ve seen here before, and certainly most of these projects help to make up the nebulous “Internet of Things” that’s all the rage these days. Once in a while though, a project comes along that really catches our eye, as is the case with [Jamie’s] meticulously documented automatic garage door opener.

This garage door opener uses an ATMega328 to connect the internet to the garage door. A reed switch is installed which lets the device sense the position of the door, which is relayed back to the internet. [Jamie] wrote an Android app that can open and close the door and give the user the information on the door’s status. One really interesting feature is the ability to “crack” the garage door. This is done by triggering the garage door opener twice with a delay in between. From the video after the break we’d say this is how [Jamie’s] cat gets in and out.

We love seeing projects that are extremely well documented so that anyone who wants to make one can easily figure out how. Internet-connected garage door openers have been featured in other unique ways before too, but we’ve also seen ways to automatically open blinds or chicken coops!

Binary Clock Would Make Doc Brown Proud

[Brett] was looking for a way to improve on an old binary clock project from 1996. His original clock used green LEDs to denote between a one or a zero. If the LED was lit up, that indicated a one. The problem was that the LEDs were too dim to be able to read them accurately from afar. He’s been wanting to improve on his project using seven segment displays, but until recently it has been cost prohibitive.

[Brett] wanted his new project to use 24 seven segment displays. Three rows of eight displays. To build something like this from basic components would require the ability to switch many different LEDs for each of the seven segment displays. [Brett] instead decided to make things easier by using seven segment display modules available from Tindie. These modules each contain eight displays and are controllable via a single serial line.

The clock’s brain is an ATmega328 running Arduino. The controller keeps accurate time using a DCF77 receiver module and a DCF77 Arduino library. The clock comes with three display modes. [Brett] didn’t want and physical buttons on his beautiful new clock, so he opted to use remote control instead. The Arduino is connected to a 433MHz receiver, which came paired with a small remote. Now [Brett] can change display modes using a remote control.

A secondary monochrome LCD display is used to display debugging information. It displays the time and date in a more easily readable format, as well as time sync information, signal quality, and other useful information. The whole thing is housed in a sleek black case, giving it a professional look.

Hacklet 26 – Arduino Projects

Arduino is one of those boards that has become synonymous with hacking and making. Since its introduction in 2005, over 700,000 official Arduino boards have been sold, along with untold millions of compatible and clone boards. Hackers and makers around the world have found the Arduino platform a cheap and simple way to get their projects off the ground. This weeks Hacket focuses on some of the best Arduino based projects we’ve found on!

drawingbot[Niazangels] gets the ball – or ballpoint pen – rolling with Roboartist, a robot which creates line drawings. Roboartist is more than just a plotter though. [Niazangels] created a custom PC program which creates line drawings from images captured by a webcam. The line drawings are converted to coordinates, and sent to an Arduino, which controls all the motors that move the pen. [Niazangels] went with Dynamixel closed loop servo motors rather than the stepper motors we often see in 3D printers.

tape[Peter Edwards] is preserving the past with Tapuino, the $20 C64 Tape Emulator. Plenty of programs for the Commodore 64, 128, and compatibles were only distributed on tape. Those tapes are slowly degrading, though the classic Commodore herdware is still going strong. Tapuino preserves those tapes by using an Arduino nano to play the files from an SD card into the original Datasette interface. [Peter] also plans to add recording functionality to the Tapuino, which will make it the total package for preserving  your data. All that’s missing is that satisfying clunk when pressing the mechanical Play button!


[Dushyant Ahuja] knows what time it is, thanks to his Infinity Mirror Clock. This clock tells time with the help of some WS2812B RGB LED. [Dushyant] debugged the clock with a regular Arduino, but when it came time to finish the project, he used an ATmega328 to create an Arduino compatible board from scratch. Programming is easy with an on-board Bluetooth module. [Dushyant] plans to add a TFT lcd which will show weather and other information when those power-hungry LEDs are switched off.

alarm2[IngGaro] built an entire home alarm system with his project Arduino anti-theft alarm shield. [IngGaro] needed an alarm system for his home. That’s a lot to ask of a standard ATmega328p powered Arduino Uno. However, the extra I/O lines available on an Arduino Mega2560 were just what the doctor ordered. [IngGaro] performed some amazing point-to-point perfboard wiring to produce a custom shield that looks and works great! The alarm can interface with just about any sensor, and can be controlled via the internet. You can even disarm the system through an RFID keycard.

Want MORE Arduino in your life? Check out our curated Arduino List!

That’s about all the millis()  we have for this weeks Hacklet. As always, see you next week. Same hack time, same hack channel, bringing you the best of!

Using The Second Microcontroller On An Arduino

While newer Arduinos and Arduino compatibles (including the Trinket Pro. Superliminal Advertising!) either have a chip capable of USB or rely on a V-USB implementation, the old fogies of the Arduino world, the Uno and Mega, actually have two chips. An ATMega16u2 takes care of the USB connection, while the standard ‘328 or ‘2560 takes care of all ~duino tasks. Wouldn’t it be great is you could also use the ’16u2 on the Uno or Mega for some additional functionality to your Arduino sketch? That’s now a reality. [Nico] has been working on the HoodLoader2 for a while now, and the current version give you the option of reprogramming the ’16u2 with custom sketches, and use seven I/O pins on this previously overlooked chip.

Unlike the previous HoodLoader, this version is a real bootloader for the ’16u2 that replaces the DFU bootloader with a CDC bootloader and USB serial function. This allows for new USB functions like HID keyboard, mouse, media keys, and a gamepad, the addition of extra sensors or LEDs, and anything else you can do with a normal ‘duino.

Setup is simple enough, only requiring a connection between the ‘328 ISP header and the pins on the ’16u2 header. There are already a few samples of what this new firmware for the ’16u2 can do over on [Nico]’s blog, but we’ll expect the number of example projects using this new bootloader to explode over the coming months. If you’re ever in an Arduino Demoscene contest with an Arduino and you’re looking for more pins and code space, now you know where to look.

10th Anniversary Trinket Pro Now in the Hackaday Store

Black solder mask and proudly sporting the Jolly Wrencher? The 10th Anniversary Trinket Pro boards just hit the Hackaday Store.

These were actually the suggestion of [Phil Torrone]. He founded Hackaday way back in 2004 and is now CEO of Adafruit Industries. Shortly after I asked him to record a remembrance of his time at Hackaday for the anniversary party he suggested these boards (normally blue and missing our logo) as a limited-edition for the event. It took just two weeks for them to crank out 585 of them.

I’m most likely biased for many reasons. Obviously I like putting the skull and wrenches on everything, and black solder mask is just cool. I also adore the ATmega328 (my 8-bit go-to chip for prototyping) and am especially fond of this form factor as it makes for super simple on-the-go firmware coding.

Once we sell 560 of them they will never return. We’re betting that Adafruit will have an even better minuscule breakout board for our 25th Anniversary. Do you think quantum computing will have trickled down to the single-chip prototyping stage by then?

Update: We’ve updated shipping rates on the store. Orders over $25 in the USA now have free shipping. International shipping is free for orders over $50. We will continue to try and reduce shipping rates as much as possible. We’re new to this so stay tuned!