Mini Project: Porting RFM69 Library from Arduino to MBED

TLDR: Here is an RFM69 OOK library for MBED.

For an upcoming project I am using the RFM69 module by HopeRF.

The RFM69HW is a transceiver module capable of operation over a wide frequency range, including the 315, 433,868 and 915MHz license-free ISM (Industry Scientific and Medical) frequency bands.

Continue reading “Mini Project: Porting RFM69 Library from Arduino to MBED”

Advertisements

Mini Project: Infra-red Repeater

As part of a larger project I’m thinking about, I wanted to see how easy it would be to make a TV remote control repeater. What it needs to do is listen for a TV remote control command, learn the command and then repeatedly send out that command.

Only 3 external components required. (I used four).

Only 3 external components required. (I used four).

For the processor I am using an Arduino Mega 2560 rip-off with the Arduino bootloader removed so that it is effectively just a development board for an Atmega2560. This has far more pins than I need, but it is very suitable for development. I am programming it using Atmel Studio 6.2 in C via an AVRISP MKII.

On the input I am using a TSOP31238 Infra-red receiver module. There are thousands of variations of this type of component, but this one has three pins:

GND Connect to ground
VCC 2.5V-5.5V
OUT Outputs low when there is a 38kHz IR signal incident on the receiver, otherwise outputs high

Therefore, it is easy to detect when an IR pulse is sent from a TV remote by listening to the output pin and waiting for it’s voltage to drop.

On the output, I am using an IR LED connected directly to the output of the Atmega, in series with a 156Ω resistor (actually a 100Ω + a 56Ω). This limits the current to about 20mA.

The code is relatively simple in concept. When the processor detects the first falling edge on the input pin, it starts a timer. Each time the input pin changes state, it stores the value of the timer in an array and resets the timer. If the timer overflows, this is taken to mean the command is over. This leaves us with an array of integers indicating how long the signal must be low or high.

The input from the IR Receiver module. The signal drops low when there is a 38kHz signal incident.

The input from the IR Receiver module. The signal drops low when there is a 38kHz signal incident. (Timebase in milliseconds).

The processor then uses the same timer to activate the output pin with the same timing as the input signal by reading back the array of integers.

There is a slight complication in that the output signal has to modulate a 38kHz square wave. This is achieved by using another timer to generate a 38kHz signal, which is then outputted to the LED only if the other timer indicates that the output should be high.

The output from the processor. The red blocks are actually 38kHz pulses.

The output from the processor. The red blocks are actually 38kHz pulses.

It then sends the signal once a second.

This works very well and it can easily copy the signals from my TV remote and repeat them to the TV. The only issue at the moment is that this method of storing the pulses takes up a relatively large amount of space – approximately 300 bytes for one command.

Project: Smart Watch – Case First Attempt Part 2

I like to think today has been pretty productive. Major advances on the case have been made to the extent that it can now be strapped to my wrist. 20140720_20221820140720_202225 Clearly there is no power the the watch, because the strap is only temporary and doesn’t contain a battery. Furthermore, the buttons are covered by a layer of plastic and cannot be pressed (more on this in another post). However, I am happy with the shape of it and am confident it can be progressed. The case consists of only two parts which will (probably) be held together with a rubber band.

Structure of the case

Structure of the case

The next step will be to drill holes for the power wires and also attach velcro for the strap.

Project: Smart Watch – Main Circuitry complete

After a bit of a break, I finally continued with the project. The first thing to do was to solder on pins to which the power is connected – pretty simple.

Then came the harder bit of attaching the bluetooth module. This was scary as it was so close to the dodgy jumpers I had soldered before and I didn’t want to melt the solder holding the jumpers in place. To minimise damage should this occur, I covered the jumpers in super glue so that, even if the solder melted, the jumpers would be held in place. With a quick dab of solder the joints were made and everything worked. A small anti-climax but a large relief.

I later realised that the bluetooth module isn’t quite parallel to the other two board, but there’s no way I’m desoldering it.

I modified my original code to fit the new board and tried it out. Here are the results:

It might be a little fragile, but it works and hopefully when it is in it’s case, it will be protected and comfortable.

Project: Smart Watch – Making PCB + Destroying PCB (oops)

Today was the day I etched the (first) PCB. I began by printing the design onto paper and ironing the trace onto a copper clad board (remembering to mirror the image because it is SMD).

ironed

 

I then etched the board in Ferric Chloride, washed it, cut it to shape and drilled the necessary holes.

cut

After multiple rounds of checking connections and scraping off incorrect connections it was time to ATTEMPT to solder the SMD components.

I began with the resistors. What I had done before was to pre-solder the pads before placing the components down. Massive mistake. This deposited loads of solder on each pad meaning I had to reheat and “solder-suck” repeatedly resulting in traces melting off the board and ruining it 😦

Accepting that this was a lost cause I chose to practice different methods of soldering.

I finally came upon the perfect method: Flux on the component, a tiny bit of solder on the component, flux on the pads, hold the component down with a sewing needle and heat each pad. This resulted in really neat joints which somewhat made up for the disaster.

massacred

Sorry for the poor image quality

Perhaps you can just make out some very neat resistors to the left and right and a complete massacre in the centre. I think this speaks for itself.

I will repeat this process again tomorrow, hopefully with happier results.

Project: Smart Watch – First Thoughts on Case

Perhaps a bit prematurely, I wanted to start designing the case for the watch.

The main principles of this case will be:

Waterproof

Simple

Attachable/Removable to/from a watch strap

Two contacts to allow for power input.

Ideally I would like to 3D-print the case, but since I don’t have a 3D-printer I need to make sure I get it right first time because it’s pretty costly to buy individual items online. (Or perhaps I could get access to one at uni?)

Therefore I have decided to first make a prototype of the case by layering up 1mm thick cross-sections of plastic.

I used PTC Creo Parametric 2.0 to design a first draft of the case and this is what I came up with:

PTC Creo design. Left to right: Hidden line, shaded, 3rd angle drawing

PTC Creo design. Left to right: Hidden line, shaded, 3rd angle drawing

So, this design includes:

Floor/short-edge panels at each end for a large metal contact set into the body. A small screw will pass through the body to connect GND and VCC to the outside of the strap.

Outer edge panels (each with a small screw) to connect the transparent top cover. Having not actually designed the cover yet, this part may well change.

I’m pretty pleased with the design. Possible modifications include thinner walls, thinner pannels… and everything.