AVR Hardware Timer Tricked Into One-Shot

[Josh] has written up two posts that those of you who use AVRs might find handy. The first post documents a C library that implements a jitter-free one-shot timer. The second post explains how it works. We think it’s such a good idea that we’re going to spoil it for you, but go ahead and read his links and check out his code.

A one-shot is a pulse generator that runs once and only once. You trigger it, it produces the desired pulse, and that’s all she wrote. Why is this handy? Many external ICs that you’ll interface with have minimum durations for signal pulses that must be respected. You could program the AVR to toggle a pin high and then sit around and wait until it’s time to toggle the pin low again, but this wastes valuable CPU time, isn’t going to be very precise, and is susceptible to timing discrepancies if interrupt routines fire in the mean time.

You’d think that you could use the hardware timers for this, but it’s not straightforward. Normally, the timers are free-running; the counter that’s keeping track of time rolls over the top and starts over again. But we just want one pulse.

[Josh]’s very clever idea abuses the timer/counter’s TOP and MATCH values in “Fast PWM” mode. Essentially you trick the counter into never matching by setting TOP below MATCH. This means that the counter spins in its loop between zero and TOP forever, doing nothing.

To break it out of its loop and enable the one-shot, you manually set the counter to a value above TOP and let it go. As it counts up, it’ll eventually hit MATCH, turn on your pin, and then keep counting. When it rolls over the top (255 + 1 = 0 for the 8-bit AVRs), your pin will be correctly turned off again and then the counter re-enters its loop. The one-shot won’t fire until you manually set the counter higher than TOP again.

So there you have it, a one-shot depending only on the hardware timer/counter module and thus immune to jitter and consuming no CPU time at all. Our hats off to you, [Josh]. Clever hack.

APRS Tracking System Flies Your Balloons

Looking for a way to track your high-altitude balloons but don’t want to mess with sending data over a cellular network? [Zack Clobes] and the others at Project Traveler may have just the thing for you: a position-reporting board that uses the Automatic Packet Reporting System (APRS) network to report location data and easily fits on an Arduino in the form of a shield.

The project is based on an Atmel 328P and all it needs to report position data is a small antenna and a battery. For those unfamiliar with APRS, it uses amateur radio frequencies to send data packets instead of something like the GSM network. APRS is very robust, and devices that use it can send GPS information as well as text messages, emails, weather reports, radio telemetry data, and radio direction finding information in case GPS is not available.

If this location reporting ability isn’t enough for you, the project can function as a shield as well, which means that more data lines are available for other things like monitoring sensors and driving servos. All in a small, lightweight package that doesn’t rely on a cell network. All of the schematics and other information are available on the project site if you want to give this a shot, but if you DO need the cell network, this may be more your style. Be sure to check out the video after the break, too!

Continue reading “APRS Tracking System Flies Your Balloons”

Laser-Cut Clock Kicks Your CAD Tools To The Curb And Opts For Python

In a world deprived of stock hardware other than #6-32 bolts and sheets and sheets of acrylic, [Lawrence Kesteloot] took it upon himself to design and build a laser-cut pendulum clock. No Pricey CAD programs? No Problem. In a world where many fancy CAD tools can auto-generate gear models, [Lawrence] went back to first principles and wrote scripts to autogenerate the gear profiles. Furthermore, not only can these scripts export SVG files for the entire model for easy laser cutting, they can also render a 3D model within the browser using Javascript.

Given the small selection of materials, the entire project is a labor of love. Even the video (after the break) glosses over the careful selection of bearings, bolt-hole spacing, and time-sensitive gear ratios, each of which may be an easy macro in other CAD programs that [Lawrence], in this case, needed to add himself.

Finally, the entire project is open source and up for download on the Githubs. It’s not every day we can build ourselves a pendulum clock with a simple command-line-incantation to

make cut

Thanks for the tip, [Bartgrantham]!

Continue reading “Laser-Cut Clock Kicks Your CAD Tools To The Curb And Opts For Python”

Retrotechtacular: Basic Telephony In The Field

Here is a great introduction to a practical application of electromagnetic theory—the field telephone. It’s a training film from 1961 that covers the sound-powered, local battery, and common battery systems along with the six basic components they use: generators, ringers, transmitters, receivers, induction coils, and capacitors.

Clear illustrations and smart narration are the hallmarks of these Army training films, and this one begins with a great explanation of generator theory. The phone’s ringer uses electromagnetic attraction and repulsion to do the mechanical work of striking the bells. Similarly, the sound waves generated by a caller’s speech move an armature to create an alternating electrical current that is transmitted and converted back to sound waves on the receiving end.

In the local battery system, the battery pushes pulsating DC to carry the voice transmission. An induction coil increases the capabilities of this system, but capacitors are required to filter out the frequencies that would overload the receiver, passing only the higher speech frequencies.

In order for several stations to communicate, the use of a switchboard is required to patch the calls through. There are many advantages of a common battery system with regard to call switching: no local battery is necessary, nor is a generator needed at each station. Calls are easier to place, and communication is much faster.

Continue reading “Retrotechtacular: Basic Telephony In The Field”

MRRF: Flexible 3D Printing

The concession stand at the Midwest Rep Rap Festival did not disappoint when it came to the expected fare: hot dogs, walking tacos, and bananas for scale. But the yummiest things there could not be bought—the Nutella prints coming off the Ultimaker² at the structur3D booth.

3D printed gasket
Flexible gasket printed in silicone atop a rigid 3D printed engine block.

Hey, what? Yes, an Ultimaker² that can print in Nutella, icing sugar, silicone, latex, wood filler, conductive ink, polyurethane, peanut butter, and a growing list to which you should contribute. This is possible because of their Discov3ry Universal Paste Extruder add-on, which is compatible with most filament printers, especially those that use a RAMPs or Arduino control board.

A large syringe containing the substance of your choice is loaded business end up in the Discov3ry. It gets pushed through tubing that runs to the print head and out through one of many commonly available polypropylene or stainless steel tips. The structur3D team has found that printing on waxed paper works best for the materials they’ve proven out. Each syringe holds 60cc of stuff, and the Discov3ry comes with three of them. They are currently available for pre-order, with a shipping forecast of early summer.

Time For The Prize: Environment-Related Ideas

You should already know about the 2015 Hackaday Prize, but have you submitted your entry yet? All it takes to get started is talking about one idea you have to address a problem faced by a large number of people. To help get the ball rolling we’re giving away some prizes to three entries that discuss possible solutions to Environment-Related problems.

For your chance at this week’s goodies all you need to do is document your idea on Hackaday.io and tag it “2015HackadayPrize”.

This Week’s Prizes:

time-for-the-prize-environment

On Monday, March 30th we’ll take a look at all the entries tagged 2015HackadayPrize and choose three that best fit the topic of Environment-Related. The best will receive the SmartMatrix 32×32 RGB LED matrix along with a Teensy 3.1 to drive it. The next pick will receive a Bus Pirate and probe cable. The final prize will be a Hackaday Robot Head Tee.

An Idea is All You Need for Entry

shower-toilet-tank-ideaWe’re not messing with you; all you need to win these early prizes is an idea. One of the most powerful pieces of the Hackaday Prize is the pollination of thought. Your idea might be the tipping point for someone else’s breakthrough or vice-versa. Start a project on Hackaday.io and add the tag “2015HackadayPrize”.

Pictured to the right is a whiteboard sketch by [MechaTweak] which illustrates one very simple shower water-saving idea (we think this was prompted by our column on the topic last week). The idea here is that instead of running water down the shower drain as you wait for it to heat up, the water cold be sequestered in a holding tank and used for flushing the toilet the rest of the day. This will certainly be in the running as it addresses the issue of water conservation. Going along with our Environment-related topic you might also tackle alternative energy production, helping detect or curb pollution, making recycling easier, reducing waste, etc.

As we move along we’ll be awarding bigger and better prizes. Submitting an idea now will give you an early start on your planning. You’ll still be eligible for future prizes, and you may submit as many entries as you like.


The 2015 Hackaday Prize is sponsored by:

Another Radio Module For IoT Fun – EMW3162

The availability of cheap radio modules is making them ubiquitous in an increasing number of projects that we have been seeing recently. The usual go-to solution is using any one of the several modules based on the ESP8266 device. [Willem] wrote in to share with us his experiences with another radio module – the EMW3162 from MXChip, which at $10 isn’t as cheap as the ESP8266 modules, but is a more capable, power packed, device.

The EMW3162 (PDF datasheet) is a low-power embedded WiFi module with integrated wireless LAN, and a STM32F205 Cortex-M3 microcontroller that runs a “self-hosted” WiFi networking library and software application stack. The microcontroller has 1M flash, 128k RAM and runs at 120MHz. And since MXChip is a Broadcom partner, they are allowed to use the WICED_SDK.

The on-board ARM M3 means all kinds of useful interfaces are available: UART, SPI, I2C, ADC, DAC, PWM, TIMERS, GPIO, and a JTAG flash interface. The good news could be on the power consumption figures – the module is touted to be low-power, and the data sheet shows 7mA when connected to an access point but with no data transfer. When transmitting at 20kbps, the current draw is about 24mA, which goes up to 320mA at 11Mbps.

[Willem] has his EMW3162_WICED repository up on Github, but also take a look at the MXChips MICO (Mico-controller based Internet Connectivity Operation System) repository. At the moment, he has it working using Linux, with a gnu gcc compiler and a JLINK JTAG programmer. He also has the WICED SDK working and has a WiFi AP with an on-board 120MHz arm chip. It would be interesting to hear about other users’ experiences with this radio module. Do let us know in the comments below!