Ask Hackaday: Your Very First Microcontroller

Necessity is the mother of invention. It is also true that invention necessitates learning new things. And such was the case on the stormy Tuesday morning our story begins.  Distant echos of thunder reverberated in the small 8 x 16 workshop, drawing my attention to the surge suppressor powering my bench.  With only a few vacation days left, my goal of finishing the hacked dancing Santa Claus toy was far from complete. It was for a Secret Santa gift, and I wanted to impress. The Santa moved from side to side as it sang a song. I wanted to replace the song with a custom MP3 track. In 2008, MP3 players were cheap and ripe for hacking. They could readily be picked up at local thrift shops, and I had picked up a few. It soon became clear, however, that I would need a microcontroller to make it do what I wanted it to do.

Continue reading “Ask Hackaday: Your Very First Microcontroller”

Electricity Usage Monitor is Linked to Google Spreadsheets

If you want to make your home more energy-efficient, chances are you will need a way to monitor your electricity usage over time. There are off-the-shelf solutions for this of course, but hackers like us tend to do things our own way. Take [Karl] for example. He recently built himself a solution with only a few smart components. We’ve seen similar projects in the past, but none quite like this.

[Karl’s] home has a power meter that blinks an LED to indicate the current amount of used electricity in Watt-hours. He knew all he needed was a way to electronically detect the blinking LED and he’d be able to accurately track his usage without modifying the meter.

The primary components used in this project were a CC3200 development kit and a photoresistor module. The dev kit contained a WiFi module built-in, which allows the system to upload data to Google spreadsheets as well as sync the built-in clock with an accurate time source. The photoresistor module is used to actually detect the blinking LED on the power meter. Everything else is done easily with code on the dev kit.

Never Forget Your USB Stick Again

USB sticks are very handy. They are a very portable and relatively inexpensive means of storing data. Possibly the most annoying part about using one of these devices is when you inevitable leave it behind somewhere by accident. This is especially true if it contains sensitive information. [Eurekaguy] feels your pain, and he’s developed a solution to the problem.

[Eurekaguy] designed a custom cap for USB sticks that beeps approximately every minute after the USB stick has been plugged in for five minutes. The cap is 3D printed and then slightly modified with four 1mm holes. Two wires are routed between these holes to make contact points for the VCC and GND pins of the USB stick.

The beep circuit is comprised of a tiny PIC12F629 microcontroller along with a couple of other supporting components. The circuit is wired together dead bug style to conserve space. Three AG5 batteries power the circuit. A small piezo speaker provides the repeating beep to remind you to grab your USB stick before you walk away from the computer.

[Thanks Irish]

DIY Electrical Body Fat Analyzer

Whether you are trying to drop some fat or build some muscle, it’s important to track progress. It’s easy enough to track your weight, but weight doesn’t tell the whole story. You might be burning fat but also building muscle, which can make it appear as though you aren’t losing weight at all. A more useful number is body fat percentage. Students from Cornell have developed their own version of an electrical body fat analyzer to help track body fat percentage.

Fat free body mass contains mostly water, whereas fat contains very little water. This means that if you were to pass an electrical current through a body, the overall bioelectrical impedance will vary depending on how much fat or water there is. This isn’t a perfect system, but it can give a rough approximation in a relatively easy way.

The students’ system places an electrode on one hand and another on the opposite foot. This provides the longest electrical path possible in the human body to allow for the most accurate measurement possible. An ATMega1284P is used to generate a 50kHz square wave signal. This signal is opto-isolated for user safety. Another stage of the circuit then uses this source signal to generate a 10ua current source at 50kHz. This is passed through a human body and fed back to the microcontroller for analysis.

The voltage reading is sent to a MATLAB script via serial. The user must also enter in their weight and age. The MATLAB script uses these numbers combined with the voltage reading to estimate the body fat percentage. In order to calibrate the system, the students measured the body fat of 12 of their peers using body fat calipers. They admit that their sample size is too small. All of the sample subjects are about 21 years old and have a similar body fat percentage. This means that their system is currently very accurate for people in this range, but likely less accurate for anyone else. Continue reading “DIY Electrical Body Fat Analyzer”

“Superfan” Gaming Peripheral Lets You Feel Your Speed

Virtual reality has come a long way but some senses are still neglected. Until Smell-O-Vision happens, the next step might be feeling the wind in your hair. Perhaps dad racing a sportbike or kids giggling on a rollercoaster. Not as hard to build as you might think, you probably have the parts already.

HAD - Superfan4Off-the-shelf devices serve up the seeing and hearing part of your imaginary environment, but they stop there. [Jared] wanted to take the immersion farther by being able to feel the speed, which meant building his own high power wind generator and tying it into the VR system. The failed crowdfunding effort of the “Petal” meant that something new would have to be constructed. Obviously, to move air without actually going on a rollercoaster requires a motor controller and some fans. Powerful fans.

A proponent of going big or going home, [Jared] picked up a pair of fans and modified them so heavily that they will launch themselves off of the table if not anchored down. Who overdrives fans so hard they need custom heatsinks for the motors? He does. He admits he went overboard and sensibly way overbudget for most people but he built it for himself and does not care.

Continue reading ““Superfan” Gaming Peripheral Lets You Feel Your Speed”

800 x 600 VGA With the STM32F4

Generating VGA is a perennial favorite on the Hackaday tips line, and it’s not hard to see why. Low-res video games, of course, but sending all those pixels out to a screen is actually a pretty challenging feat of coding. The best most project have attained is the original VGA standard, 640×480. Now that we have fast ARMs sitting around, we can bump that up to 800×600, like [Karl] did with an STM32F4 Discovery board.

The problem with generating VGA on a microcontroller is the pixel frequency – the speed at which pixels are shoved out of the microcontroller and onto the screen. For an 800×600 display, that’s 36 MHz; faster than what the 8-bit micros can do, but a piece of cake for the STM32F4 [Karl] is using.

[Karl] started his build by looking at the VGA project Artekit put together. It too uses an STM32, but a 36-pin F103 part. Still, it was fast enough to generate a line-doubled 800×600 display. [Karl] took this code and ported it over to the F4 part on the Discovery board that has enough space for a full 800×600 frame buffer.

With all that RAM on board the F4 part, [Karl] was able to expand the frame buffer and create a relatively high-resolution display with DMA and about a dozen lines of code. It looks great, and now we just need a proper application for high-resolution VGA displays. Retrocomputing? A high-resolution terminal emulator? Who knows, but it’s a great use for the STM32.

If circles and some text aren’t your thing, Artekit also has Space Invaders running on the 36-pin STM32.

Prototyping With The ATMega1284P

While most people are moving onto ARMs and other high-spec microcontrollers, [Dave Cheney] is bucking the trend. Don’t worry, it’s for a good reason – he’s continuing work on one of those vintage CPU/microcontroller mashups that implement an entire vintage system in two chips.

While toying around with the project, he found the microcontroller he was using, the ATMega1284p, was actually pretty cool. It has eight times the RAM as the ever-popular 328p, and twice as much RAM as the ATMega2560p found in the Arduino Mega. With 128k of Flash, 4k of EEPROM, 32 IOs, and eight analog inputs, it really starts to look like the chip the Arduino should have been built around. Of course historical choices don’t matter, because [Dave] can just make his own 1284p prototyping board.

The board is laid out in Fritzing with just a few parts including a crystal, a few caps, an ISP connector, and pins for a serial connector. Not much, but that’s all you need for a prototyping board.

The bootloader is handled by [Maniacbug]’s Mighty 1284 Arduino Support Package. This only supports Arduino 1.0, not the newer 1.5 versions, but now [Dave] has a great little prototyping board that can be put together from perfboard and bare components in a few hours. It’s also a great tool to continue the development of [Dave]’s Apple I replica.