I’ve not actually written anything here for quite some time (it turns out that doing a part-time PhD really eats into your electronics project time… Who’d’ve thought!); so I thought I’d take advantage of the current isolation and a few days off over the Bank Holiday, to catch-up with some blogging…
The venerable NE555 timer IC was introduced in 1972; and due to its versatility is without doubt one of the most common integrated circuits ever made.
I finally got around to building it, and since I have to say that it’s a really nice kit; and it would make a great electronics project for kids (aged about 12-18) too. It’s a really well laid-out board; and the use of through-hole components makes it easy to assemble. It took me about 45-minutes to solder it – but you could easily do it in more like 30-minutes, if you were less fussy about how it looked; and it might take you anything up to a couple of hours if you’d never soldered before… The instructions are very clear; and the components are supplied fixed on to clearly marked cards, to make it trivial to identify which goes where.
[latexpage]The Microchip MCP9808 is a high precision temperature sensor with an I2C interface – making it easy to interface with microcontroller or embedded Linux electronics. The chip has a very small form-factor: available as either an 8-pin DFN package – or an 8-pin MSOP package. For hobbiest purposes DFN is almost impossible to use due to the complexity of having to reflow solder under the contacts; and MSOP is quite challenging (though it can be done with care). If you want something easy to use with a breadboard however, the good folks at Adafruit can come to the rescue – as they sell the device pre-soldered to a SIP breakout board. (Also available from Makersify in the UK).
Adafruit have done a great job with these libraries and most users will be delighted that “it just works”; but I want to explore how it all works: how to actually communicate with chip directly – using I2C. This guide written from the point of view of an Arduino; but you should be able to follow along from any other device if you’re reasonably familiar with I2C and low-level coding.
The MintyBoost is an open-source, small form-factor, USB charger which runs on AA batteries – and lets you charge your mobile phone, tablet or other USB device, without the need for mains power or a computer. It was designed by one of the leading proponents of the open-source hardware movement, LadyAda – aka MIT Engineering graduate: Limor Fried
BeagleBone is a small, low(ish) cost, open-source Linux computer on a board – using an ARM Cortex-A8 processor running at 720 MHz, with 256 MB of RAM. Unlike an Arduino – this is a fully-fledged computer. This makes it extremely powerful – and makes it a nice device to play with, to learn about embedded Linux.
This added power and sophistication does come at a cost though: this is not (or at least not currently) a tool for complete beginners in the way that an Arduino can be. This is a Linux computer – so if you want to use it to it’s full potential, then you’d better know your way around the Linux command-line.
It runs Ångström Linux – which is a flavour of Linux specifically produced for embedded devices. It’s used as the embedded OS on a number of commercial products. Whilst this is great because it means that there are a large number of people working on keeping Ångström really up-to-date; it’s also a challenge for the hobbyist – because it is very strongly focussed on the embedded device community.
BeagleBone itself is quite a new product (it only came out a few months ago) – so although there’s quite a community around it’s big-brother (the BeagleBoard) some of the documentation for the BeagleBone is a bit patchy.
The first instruction in the getting started manual is to update the software on the board to the latest version of Ångström Linux. This posed quite a challenge, even for me – and I’ve quite a few years of Linux experience (and I’m a some-time sysadin): so it’s definitely not something for someone completely new to the command-line.
If you’re struggling with this – I do have a couple of tips, however. The instructions on the various web pages aren’t really all that well written – unless you’re already familiar with the process. Telling novice users to “Learn to use ‘dd‘ and ‘gzip‘ “ or “know which /dev/sdX or /dev/diskX is your SD card through use of ‘dmesg‘” isn’t very helpful. If you’re already familiar with these tools then this instruction adds nothing – and if you’re not: then the provided links aren’t really going to help…
The first thing that I’d recommend is that you do the update using another Linux computer. Whilst Mac OS X is just a pretty front-end for UNIX, and therefore everything should be just as easy under OS X – it didn’t really turn out to be quite that simple. I could only find the latest version of Ångström in an img.xz archive, and out-of-the-box OS X doesn’t have any tools to let you work with that format: and although adding a suitable command-line tool is quite trivial it’s one extra step that you (almost certainly) wouldn’t have to make with a Linux box.
More of a problem is the way that OS X mounts the SD card. Despite spending several hours digging about, I couldn’t actually find the device representing the SD card. Because the download is (essentially) a disk image – you need to point the archive tools at the low-level device rather than it’s mount-point in the file-system.
Anyway, the long and the short of it is that if you download the image file on a Linux system, and then run the following incantation (obviously replacing the filename with the name of the image file you just downloaded) – it’ll probably work just fine. The only caveat on that is if you have more than one physical drive on your computer – in which case you may need to change the /dev/sdb to something else).
Note the addition of the --verbose flag to the command. This is going to take quite a while (~20 minutes) to run – so it’s nice to be able to see that something is indeed happening!
Once you’re up and running the latest version of Ångström, then what?
That said, Bonescript & Cloud9 do let you very easily run some classic blink light code (the hardware / embedded equivalent of “Hello World!”)
This blinks one of the user LEDs on the board itself – and will blink an external LED driven from pin 3 on header 8 (the bottom header, if you have the board facing up, and have the ethernet port on the right).
As I say, not particularly useful – but at least it shows that everything is working!
The real power of BeagleBone is using it to control hardware from Python or C code: and coupling it with the device’s on-board web server.
So look out for a follow-up post, looking at some more interesting things to do with a BeagleBone, in the near future (just as soon as I’ve worked it all out myself!)… 🙂
In my last few posts I’ve been writing about using an Arduino to generate waveforms. Part 3 of that series is still in the works (I’ve not forgotten, honestly!) – but this time I want to write about an alternative way to make a simple waveform: using good old analogue electronics, without the need for a microcontroller.
To do this we’ll use the ubiquitous NE555 timer chip (or just a 555 for short). The 555 is almost certainly the first IC you’ll play with if you’re learning analogue electronics at school or college – and for good reason, you can do all kinds of things with 555 timers – and whole books have been written on the subject. I’m not going to compete with any of those (Google, Amazon and Wikipedia will be your friends if you want to find out more). Or have a look at the datasheet…
Using a 555 to produce a square wave is a really nice easy circuit to have a go at if you’re new to electronics: as it’s not too complicated to build – and it’s pretty easy to understand what’s going on.
There are a handful of different basic ways to use a 555 – known as monostable, bistable, and astable. In a monostable configuration, the 555 will generate a single pulse (or a length determined by the configuration of the rest of the circuit), so it can be used, for example, as the basis of a simple electronic timer (such a circuit was my first ever electronics project – about twenty years ago!). In a bistable circuit, the 555 can be used as a latched flip-flop – turning on or off an output, depending on the state of two pulse inputs.
We’re interested in the astable configuration though – as that will let us generate a series of pulses in the form of our square wave.
Let’s start by looking at the circuit.
As you can see it’s a pretty simple circuit – with just the 555 IC, two resistors, and two capacitors. Additionally if we want to be able to vary the frequency, we can add a potentiometer (variable resistor) in series with R2, and to drive larger loads we can use a transistor switched by the output from pin 3 (as I’ve done here)…
So how does it work?
First of we need to understand an RC (resistor – capacitor) network. A capacitor charges and discharges at a rate proportional to the value of the resistance. This means that there’s an exponential relationship between the capacitor voltage and time… Specifically:
When the voltage on the timing capacitor (C1) reaches 2/3 of the supply voltage (Vcc) the 555 triggers the flip-flop (via pin 2) and the capacitor starts to discharge, when it drops to 1/3 Vcc, the flip-flop flips again, and starts the capacitor charging again. When C1 is charging the RC is dependant on both R1 and R2; when it’s discharging only R2 comes into play because of the connection to pin 7 between the two resistors.
Don’t worry if you don’t understand exactly how the 555 flip-flop works (it’s slightly out of the scope of this post – but maybe I’ll write something about that if people are interested): the important thing is the that the time taken to perform these charge / discharge cycles is what determines the frequency of the square wave generated.
Specifically the frequency is the reciprocal of the time taken for the circuit to go high + the time taken to go low…
So in our case the frequency should be:
And, sure enough – here’s what the oscilloscope gives us…