Overclocking microcontrollers

fire

We’re all familiar with overclocking desktop computers; a wonderful introduction to thermal design power and the necessities of a good CPU cooler. [Marcelo] wanted to see how far he could overclock a microcontroller – in this case an ATMega328 – and ended up with a microcontroller designed for 20 MHz running at 30 MHz.

To verify that his uC could run at higher clock speeds, [Marcelo] began his experiments by uploading a piece of code that toggled a few pins as fast as possible. He needed to upload this code with a common 16 MHz crystal – AVRDude simply won’t work when a chip is clocked at higher speeds.

After successfully demonstrating his microcontroller will turn pins on and off at 30 MHz, [Marcelo] wanted to see if he could do something useful. By editing a single setting in his Arduino boards.txt file., [Marcelo] was able to have his overclocked microcontroller read and reply to characters sent over a serial connection. It worked, demonstrating an overclocked microcontroller could be useful in some situations.

As for what [Marcelo] plans to do with his faster microcontroller, he’s thinking of improving a ATMega-powered VGA color generator. A higher clock speed means he can push more pixels out to a VGA monitor.

Weird Processing Unit only has 4 instructions

[Tomáš], a.k.a. [Frooxius] is playing around with computational theory and processor architectures – a strange hobby in itself, we know – and has created the strangest CPU we’ve ever seen described.

The Weird Processing Unit, or WPU, isn’t designed like the Intel or ARM CPU in your laptop or phone. No, the WPU is a thought experiment in computer design that’s something between being weird for the sake of being weird and throwing stuff at the wall and seeing what sticks.

The WPU only has four instructions, or attoinstructions, to change the state of one of the 64 pins on the computer – set to logical 1, set to logical 0, invert current state, and halt. These instructions are coded with two bits, and the operand (i.e. the wire connected to the computer) is encoded in another six bits.

These 64 wires are divided up into several busses - eight bit address and control busses make up the lowest 16 bits, a 32-bit data bus has a function akin to a register, and a 16-bit ‘Quick aJump bus’ provides the program counter and attocode memory. The highest bit on the WPU is a ‘jump bit’, implemented for unconditional jumps in code.

We’re not even sure the WPU can even be considered a computer. We realize, though, that’s probably not the point; [Tomáš] simply created the WPU to do something out of the ordinary. It’s not meant to be a real, or even useful, CPU; it’s simply a thought experiment to see what is possible by twiddling bits around.

Tip ‘o the hat to [Adam] for sending this one in.

A JavaScript interpreter for ARM ‘micros

When programming a microcontroller to do your bidding, you only have two choices. You could write your code in a proper language such as C and cross-compile your source into a piece of firmware easily understood by a micro. Alternatively, your could load an interpreter on your microcontroller and write code via a serial connection. Interpreters are a really fast and easy method to dig in to the hardware but unfortunately most microcontroller interpreters available are based on BASIC or Forth.

[Gordon] figured it’s not 1980 anymore, and interpreters for these relatively low-level languages aren’t a good fit with the microcontrollers of today. To solve this problem, he created Espruino, a JavaScript interpreter for the new batch of ARM development boards that have been cropping up.

Espruino is designed for the STM32VL Discovery board, although [Gordon] plans on porting his interpreter to the Arduino Due when he can get his hands on one. Installation is as easy as uploading any other piece of firmware, and even though [Gordon]‘s STM32VL doesn’t have a USB port for a serial terminal, it’s a snap to connect a USB to TTL converter and get this interpreter working.

Espruino isn’t open source yet, only because [Gordon] would like to clean up his code and write a bit of documentation. He’d also like to make Espruino profitable so he can work on it full-time, so if anyone has an idea on how [Gordon] can do that, leave a note in the comments.

The easiest way to dive in to ARM programming

[Brad] has been very excited about an ARM Cortex-M0 chip released by NXP; it’s a fully featured ARM microcontroller, and is, quite amazingly, stuffed into a hobbyist and breadboard-friendly DIP-28 package. After finding a supplier for this chip, [Brad] dove in and put together a great tutorial for programming an ARM on the breadboard using open source tools.

The chip in question is NXP’s LPC1114FN28, a 28-pin breadboard friendly chip we’ve posted about before. After finding a single supplier for this microcontroller (only $1.26 for one chip!), [Brad] pulled out his breadboard and started wiring things up.

Because this microcontroller has an on-board oscillator, wiring up a breadboard and putting in a breakout for an FTDI cable was a snap. After configuring a toolchain and writing a bit of code, the only issue was uploading the code to the chip. This was handled by the lpc21isp programming tool, slightly modified and configured by [Brad] to support his favorite microcontroller.

The LPC1114FN28 is an impressive bit of kit, and with free tools to program the damn thing, we can’t wait for a homebrew ARM dev board to show up.

Making capacitive touch sensors with pencil and paper

capacitive-touch-sensor

There are few things more frustrating than being in the middle of working on a project and realizing that you are missing some crucial component that ties the whole thing together. According to Murphy’s Law, this sort of thing will only happen when parts are completely impossible to procure.

If you’re ever hunting for a touch sensor but can’t get your hands on one, [Alan Chatham’s] tutorial on simple DIY capacitive touch sensors might be just what you need to keep things moving along.

[Alan’s] sensors rely on the conductive properties of graphite, which is easily found in just about any pencil on the market. The sensors are created by simply drawing on a piece of paper with a pencil, then wiring the images or text up to your favorite microcontroller via some paperclips and a couple of resistors.

Paper and pencil might not make for the most durable means of input, but we’re pretty sure that [Alan’s] capacitive touch sensors would be very helpful in a pinch. He doesn’t have video of the sensors in action just yet, though he says he’ll put something together here shortly.

Microcontroller comm with a computer monitor

Prolific Hack a Day author [Mike S] has been playing in his lab again and he’s come up with a neat way to talk to microcontrollers with an LCD monitor. The basic idea behind [Mike]‘s work isn’t much different from the weird and/or cool Timex Datalink watch from the 1990s.

Despite the fancy dev board, the hardware is very simple – a photoresistor is pointed at a computer monitor and reads bits using Manchester encoding. The computer flashes a series of black and white screens thanks to a simple Javascript/HTML page, and data is (mostly) transmitted to the micro. [Mike] says he has about a failed message about 60% of the time, and he’s not quite sure where the problem is. He’s looking into another kind of Manchester encoding that uses samples instead of edges, so we hope everything works out for him.

This build is very similar – and was inspired by – an earlier post about microcontroller communication with flashing lights. Still, [Mike]‘s build reminds us of the strangely futuristic Ironman watch we had in ’97. Check out [Mike]‘s demo of his computer/micro comm link after the break and his code on github.

[Read more...]

Sound card microcontroller/PC communication

The usual way send data from a microcontroller is either over RS-232 with MAX232 serial ICs, crystals, and a relatively ancient computer, or by bit-banging the USB protocol and worrying about driver issues. Not content with these solutions, [Scott] came up with sound card μC/PC communication that doesn’t require any extra components.

[Scott] bought a cheap USB sound card dongle on eBay (although a built-in sound card will do) and wired up the tip and ring of the plug to the microcontroller. The data is sent from the microcontroller a lot like Morse code – a short gap between pulses is a zero, a long gap is a one. This is parsed by a Python script using PyAudio. Synchronization, timing, and calibration is automatic because of a 10-bit ‘packet header’ explained in this video.

[Read more...]