[Paulie] over on the EEVBlog forums picked up an inexpensive frequency counter on eBay and realized it was just a little bit off. As a result, he decided to build a frequency standard. His build wound up costing him about $3 and he shared the design and the software for it.
The hardware design is very simple: a TCXO (also from eBay), an ATMega8, a pushbutton, and a AA battery with DC to DC converter to power the whole thing. The software does all the work, providing frequencies from 10MHz down to a few hundred hertz (including some common audio test frequencies).
If you haven’t worked with a TCXO before, it is a crystal oscillator that includes a temperature compensation circuit to pull the crystal frequency up or down depending on temperature. Although crystal oscillators are pretty accurate already, adding this temperature compensation improves accuracy over the design temperature dramatically (typically, 10 to 40 times better than a naked crystal oscillator). If you want to learn more about TCXOs, here’s a good write-up.
A TCXO isn’t as good as an OCXO (where the first O stands for Oven). However, OCXOs cost more, are larger, and drain batteries (after all, it is running an oven). You can even hack your own OCXO, but it is going to cost more than $3.
If you want to see the real guts of one TCXO, check out the video.
[Stian] thought it would be nice if his coworkers could be electronically notified when the latest batch of coffee is ready. He ended up building an inexpensive coffee alarm system to do exactly that. When the coffee is done, the brewer can press a giant button to notify the rest of the office that it’s time for a cuppa joe.
[Stian’s] first project requirement was to activate the system using a big physical button. He chose a button from Sparkfun, although he ended up modifying it to better suit his needs. The original button came with a single LED built-in. This wasn’t enough for [Stian], so he added two more LEDs. All three LEDs are driven by a ULN2003A NPN transistor array. Now he can flash them in sequence to make a simple animation.
This momentary push button supplies power to a ESP8266 microcontroller using a soft latch power switch. When the momentary switch is pressed, it supplies power to the latch. The latch then powers up the main circuit and continues supplying power even when the push button is released. The reason for this power trickery is to conserve power from the 18650 li-on battery.
The core functionality of the alarm uses a combination of physical hardware and two cloud-based services. The ESP8266 was chosen because it includes a built-in WiFi chip and it only costs five dollars. The microcontroller is configured to connect to the WiFi network with the push of a button. The device also monitors the giant alarm button.
When the button is pressed, it sends an HTTP request to a custom clojure app running on a cloud service called Heroku. The clojure app then stores brewing information in a database and sends a notification to the Slack cloud service. Slack is a sort of project management app that allows multiple users to work on projects and communicate easier over the internet. [Stian] has tapped into it in order to send the actual text notification to his coworkers to let them know that the coffee is ready. Be sure to watch the demo video below. Continue reading “Alarm Notifies the Office When the Coffee is Ready”→
[Carlos] needed an ADC with a 50 nanosecond sample period for his laser lab, that’s 20Msps! (20 million samples a second). While in recent years, commodity ADCs reaching into the low GSPS have become available, integrated acquisition systems are still somewhat expensive. So [Carlos] decided to do what every good hacker does, and built his own solution. His project post pretty much just links to a whitepaper he wrote (PDF) so we’ll try and boil it down for you:
In order to simplify development [Carlos] borrowed a technique commonly used in the first era of digital oscilloscopes, Equivalent Sampling Time.
The figure to the right is from the TDS460 manual. While it may seem counter intuitive to those only familiar with modern scopes, the TDS460 achieved a 400MHz bandwidth using a 100MSPS ADC. In order to achieve this the scope acquires a single trace in multiple cycles, each time offsetting the acquisitions as shown and combining the result.
In this way, early digital scope developers could sidestep the limitations of the available ADCs to achieve a higher effective bandwidth. However there is of course one catch: the technique only works for periodic signals.
This was fine for [Carlos] who implemented a technique on a Cypress PSoC 4, which provides analog FPGA-like functionality. By offsetting the ADC trigger he has able to achieve an EST of 48MHz using a ADC sampling at 1MHz. If you want a little help getting into PSOC 4 yourself, check out the guide that [Bil Herd] made.
Neat hack [Carlos] and we hope to hear more about your laser lab in the future.
TI sells four different models of their CC26XX wireless MCUs. Three support one of the following: RF4CE, Zigbee/6LoWPAN, and Bluetooth and a further model which supports all protocols. Each IC has the same baseline specification: 128Kb Flash, 20Kb RAM and 15 GPIOs. [Jelmer] was curious to know if the price difference was all in the software. And in order to verify this decided that decapping was the only thing to do!
We’ve covered decapping using Nitric acid before, as well as lower tech techniques. Luckily [Jelmer] had access to Nitric acid and a fume hood, not the easiest items to get hold of outside of a research lab (checkout the video of the IC bubbling away below). [Jelmer] got some great die shots under an optical microscope and was able to confirm that the die markings are identical. This opens the door to future hacks, which might allow the cheaper models to be re-flashed, expanding their capabilities.
When working on digital circuits that operate at high frequencies it helps to have some special tools on hand. Things like oscilloscopes and logic analyzers are priceless when something isn’t working right. Another great tool would be this hardware-based profiler that [Mike] came up with while he was working on another project.
The profiler connects to USB and shows up as a serial port. Normally [Mike] used a set of LEDs to get information about how his microcontrollers work, but for this project that wasn’t enough. The uController Code Profiler can provide the main loop running time, time functions and sections of code, keep track of variables, and a few other tasks as well, all with nanosecond resolution.
The source code isn’t provided but a hex file is available, along with a schematic and an include file, if you want to try this one out on your next project. Like this homemade logic analyzer, this could be a powerful tool in your microcontroller arsenal. Simply include the file with various pieces of your code to get it up and running!
A lot of microcontroller projects out there need some sense of wall-clock time. Whether you’re making (yet another) crazy clock, logging data, or just counting down the time left for your tea to steep, having access to human time is key.
The simplest solution is to grab a real-time-clock (RTC) IC or module. And there’s good reason to do so, because keeping accurate time over long periods is very hard. One second per day is 1/86,400 or around eleven and a half parts per million (ppm), and it’s tricky to beat twenty ppm without serious engineering.
Good RTC ICs like Maxim’s DS3231, used in the Chronodot, can do that. They use temperature correction logic and a crystal oscillator to get as accurate as five parts per million, or under half a second per day. They even have internal calendar functions, taking care of leap years and the day of the week and so on. The downside is the cost: temperature-compensated RTCs cost around $10 in single quantity, which can break the budget for some simple hacks or installations where multiple modules are needed. But there is a very suitable alternative.
What we’re looking for is a middle way: a wall-time solution for a microcontroller project that won’t break the bank (free would be ideal) but that performs pretty well over long periods of time under mellow environmental conditions. The kind of thing you’d use for a clock in your office. We’ll first look at the “obvious” contender, a plain-crystal oscillator solution, and then move on to something experimental and touchy, but free and essentially perfectly accurate over the long term: using power-line frequency as a standard.
How can you generate random bits? Some people think it’s not easy, others will tell you that it’s pretty damn hard, and then there are those who wonder if it is possible at all. Of course, it is easy to create a very long pseudorandom sequence in software, but even the best PRNG (Pseudorandom Number Generator) needs a good random seed, as we don’t want to get the same sequence each time we switch on the unit, do we? That’s why we need a TRNG (True Random Number Generator), but that requires special hardware.
Some high-end microprocessors are equipped with an internal hardware TRNG, but it is, unfortunately, not true for most low-cost microcontrollers. There are a couple of tricks hackers use to compensate. They usually start the internal free running counter and fetch its contents when some external event occurs (user presses a button, or so). This works, but not without disadvantages. First, there is the danger of “locking” those two events, as a timer period may be some derivative of input scan routine timing. Second, the free running time (between switching on and the moment the unit requests a random number) is often too short, resulting in the seed being too close to the sequence start, and thus predictable. In some cases even, there is no external input before the unit needs a random seed!
Despite what has already been discussed, microcontrollers do have a source of true randomness inside them. While it might not be good enough for crypto applications, it still generates high enough entropy for amusement games, simulations, art gadgets, etc.