Jeremy Harris
Senior Member
Some may recall this thread: http://www.picaxeforum.co.uk/showthread.php?28761-Alternative-to-ERF where I started off looking for a replacement for the now-discontinued ERF transceiver modules and the conversation drifted into a discussion about the cheap Chinese HC-11 and HC-12 modules that abound on a certain auction site. In that thread I found that the range performance of the HC-11 modules at 9600 baud was disappointing, even when fitted with a decent 1/4 wave antenna, rather than the small helical antenna that is supplied with the module.
Following on from that, and from advice given by Stan on a supplier here: http://www.picaxeforum.co.uk/showthread.php?28761-Alternative-to-ERF&p=297481&viewfull=1#post297481 I ordered some HC-12 modules, and I have to say they arrived very quickly, just over a week, which is pretty good for a Chinese supplier to the UK. Interestingly, the HC-12 modules I ordered a week earlier from another supplier haven't yet turned up.
I intend to carry out some proper, side-by-side range comparisons between the HC-11 and HC-12 later, as soon as I've built some test boxes, but my immediate requirement was to set up a remote switch in my garage (at the end of the garden) so that I could turn something on or off from anywhere in the house or garden with a hand held remote, and have confirmation on that remote that the switch had actually activated.
Both ends use 08M2s, running at the standard 4MHz. After my experience with the HC-11s, I decided to programme the HC-12s using an FTDI on a USB cable, and the software Stan linked to in this post: http://www.picaxeforum.co.uk/showthread.php?28761-Alternative-to-ERF&p=297250&viewfull=1#post297250 which can be downloaded from this link he gave to the Back Shed Forum: http://www.thebackshed.com/forum/forum_posts.asp?TID=8246&PN=1 . This software makes programming these cheap little transceivers really easy, it takes just seconds to do, provided you have plugs and sockets handy. My next test set up will use plug and socket strip connections, so that I can easily unplug the transceivers, re-programme them and see how the performance changes.
Right now I thought I'd report on what I have working and how it performs, as a starter, with luck I'll get more testing done in the next week or so.
The first thing to say is that these modules, either the HC-11 or the HC-12, are extremely easy to use with a Picaxe. They happily work at Picaxe-type voltages (I'm running the fixed switch in the garage from a 5V supply and the hand held unit from 3 off AA cells, so around 4.5V). They are fussy about baud rate, as they seem to use pretty exact baud rate timing, whereas (as previously reported) Picaxe software serial port baud rate timing can have some significant errors at some internal clock speeds (for example, if you want to use 9600 baud you pretty much have to setfreq to M16 or M32 to get the baud rate within the acceptable range for a lot of hardware serial devices).
Anyway, back to the remote switch. The basic scheme I used was to send a 13 bytes code from the hand-held unit as a "wake up" call, with the remote switch sending a different 13 byte code back to say that it was ready for a command. The handheld unit then sent another 13 byte code as a command to the remote switch, one code for "switch on" another code for "switch off". The remote unit switched the appropriate relay and when it had done that it transmitted back another 13 byte code as an acknowledgement. This last received code turned on an LED on the hand-held unit so that I had confirmation that the relay at the remote end had really operated.
This isn't really a super-secure requirement, although sending sequences of 13 byte random-looking characters back and forth, with the appropriate handshakes, means it is really pretty secure in practice, it would take a persistent bit of listening and reverse engineering to figure out what was going on. It could be made more secure by using all available bytes on the 08M2 (so 28 byte coded messages instead of 13 bytes), and even more secure by implementing some form of rolling code algorithm, but for my needs out in the country for a low security switch I deemed this system secure enough.
After my experience with the poor range of the HC-11, I opted to programme the HC-12s in their "long range" mode, FU4 (a claimed 1800m), that works at a supposed 1200 baud. I kept within the UK licence exempt band with the set frequency (I used channel 4, which is 434.6MHz), but did break the rules with power, and left the units at the default +20dBm (100mW) and with hindsight I could have easily used +10dBm (10mW), and I may well unsolder the modules and re-programme them one day.
I fitted the hand-held unit into a small plastic box that would just take 3 off AA cells plus the circuit board, two push buttons and the LED, and used the supplied small helical antenna. I fitted the remote unit into another plastic box, screwed to the inside of the garage wall and powered from a small 1W mains power supply. Because I had some space there, I used a 1/4 wave (approx) antenna, a bit of stainless steel wire cut to the right length. I didn't do any antenna optimisation at all, the garage unit is vertically polarised, the hand held unit is vertically polarised if held vertically, but will most often be at some angle, so there will be a fair bit of polarisation loss in the path.
The test today was to see if the unit would work, with me being able to operate the remote switch from anywhere inside the house, even the very farthest corner, where the signal has to pass through 4 internal walls plus an external wall that is extremely effective RF screen (it's over 400mm thick, has a foil-type membrane in it and the triple glazed windows are metal sputtered to reduce long wavelength IR loss, so are also good RF screens). The good news is that it works very reliably from anywhere inside the house, even with the hand-held unit horizontal. The down side is that the signal transmission time seems way too long for 1200 baud, it takes 5 seconds from pressing the button on the hand-held unit to receiving the confirmation LED. I originally had 2 second timeouts on the serin commands both ends, but found that to get the system to work reliably I had to increase these to 4 seconds.
Having got the unit working. I decided to see how far it would work, so I went for a walk around the village. I can confirm that it still works fine at over 400m (as far as I went - lunch was calling!). That was through other houses and gardens and over the top of a small rise, so not really line-of-site. I have no doubt that the claimed 1800m range line of sight is genuine, or that I could run at a much lower power and still have a reliable link for my purpose.
It'd be nice to know what's going on inside these units, though, as the transmission time is puzzling. Each 13 byte transmission should take a bit over 1/10th second (I think) and there are a total of five transmissions, with an inherent 1.5s delay in the software, so that means it should take around 2 seconds from button press to receipt of the LED confirmation, not 5 seconds. I'm guessing that the modules aren't actually transmitting over-the-air at 1200 baud, but may have buffering within the microcontroller that's on the board.
Anyway, I thought this update on performance was worth posting. Based on my findings I'd not bother with the HC-11 modules at all, unless you only need a very short range and are happy with a low baud rate (my guess is that the HC-11s will work better with a lower baud rate when I get around to doing some proper testing). If you want cheap and reliable long range links, then the HC-12 is hard to beat. They are cheap (less than £3.20 each including the antenna and shipping) they don't give out any spurious data (so they don't upset the serin command) and they seem easy to use.
More will follow when I've had some time to make some test units up for proper range testing.
Following on from that, and from advice given by Stan on a supplier here: http://www.picaxeforum.co.uk/showthread.php?28761-Alternative-to-ERF&p=297481&viewfull=1#post297481 I ordered some HC-12 modules, and I have to say they arrived very quickly, just over a week, which is pretty good for a Chinese supplier to the UK. Interestingly, the HC-12 modules I ordered a week earlier from another supplier haven't yet turned up.
I intend to carry out some proper, side-by-side range comparisons between the HC-11 and HC-12 later, as soon as I've built some test boxes, but my immediate requirement was to set up a remote switch in my garage (at the end of the garden) so that I could turn something on or off from anywhere in the house or garden with a hand held remote, and have confirmation on that remote that the switch had actually activated.
Both ends use 08M2s, running at the standard 4MHz. After my experience with the HC-11s, I decided to programme the HC-12s using an FTDI on a USB cable, and the software Stan linked to in this post: http://www.picaxeforum.co.uk/showthread.php?28761-Alternative-to-ERF&p=297250&viewfull=1#post297250 which can be downloaded from this link he gave to the Back Shed Forum: http://www.thebackshed.com/forum/forum_posts.asp?TID=8246&PN=1 . This software makes programming these cheap little transceivers really easy, it takes just seconds to do, provided you have plugs and sockets handy. My next test set up will use plug and socket strip connections, so that I can easily unplug the transceivers, re-programme them and see how the performance changes.
Right now I thought I'd report on what I have working and how it performs, as a starter, with luck I'll get more testing done in the next week or so.
The first thing to say is that these modules, either the HC-11 or the HC-12, are extremely easy to use with a Picaxe. They happily work at Picaxe-type voltages (I'm running the fixed switch in the garage from a 5V supply and the hand held unit from 3 off AA cells, so around 4.5V). They are fussy about baud rate, as they seem to use pretty exact baud rate timing, whereas (as previously reported) Picaxe software serial port baud rate timing can have some significant errors at some internal clock speeds (for example, if you want to use 9600 baud you pretty much have to setfreq to M16 or M32 to get the baud rate within the acceptable range for a lot of hardware serial devices).
Anyway, back to the remote switch. The basic scheme I used was to send a 13 bytes code from the hand-held unit as a "wake up" call, with the remote switch sending a different 13 byte code back to say that it was ready for a command. The handheld unit then sent another 13 byte code as a command to the remote switch, one code for "switch on" another code for "switch off". The remote unit switched the appropriate relay and when it had done that it transmitted back another 13 byte code as an acknowledgement. This last received code turned on an LED on the hand-held unit so that I had confirmation that the relay at the remote end had really operated.
This isn't really a super-secure requirement, although sending sequences of 13 byte random-looking characters back and forth, with the appropriate handshakes, means it is really pretty secure in practice, it would take a persistent bit of listening and reverse engineering to figure out what was going on. It could be made more secure by using all available bytes on the 08M2 (so 28 byte coded messages instead of 13 bytes), and even more secure by implementing some form of rolling code algorithm, but for my needs out in the country for a low security switch I deemed this system secure enough.
After my experience with the poor range of the HC-11, I opted to programme the HC-12s in their "long range" mode, FU4 (a claimed 1800m), that works at a supposed 1200 baud. I kept within the UK licence exempt band with the set frequency (I used channel 4, which is 434.6MHz), but did break the rules with power, and left the units at the default +20dBm (100mW) and with hindsight I could have easily used +10dBm (10mW), and I may well unsolder the modules and re-programme them one day.
I fitted the hand-held unit into a small plastic box that would just take 3 off AA cells plus the circuit board, two push buttons and the LED, and used the supplied small helical antenna. I fitted the remote unit into another plastic box, screwed to the inside of the garage wall and powered from a small 1W mains power supply. Because I had some space there, I used a 1/4 wave (approx) antenna, a bit of stainless steel wire cut to the right length. I didn't do any antenna optimisation at all, the garage unit is vertically polarised, the hand held unit is vertically polarised if held vertically, but will most often be at some angle, so there will be a fair bit of polarisation loss in the path.
The test today was to see if the unit would work, with me being able to operate the remote switch from anywhere inside the house, even the very farthest corner, where the signal has to pass through 4 internal walls plus an external wall that is extremely effective RF screen (it's over 400mm thick, has a foil-type membrane in it and the triple glazed windows are metal sputtered to reduce long wavelength IR loss, so are also good RF screens). The good news is that it works very reliably from anywhere inside the house, even with the hand-held unit horizontal. The down side is that the signal transmission time seems way too long for 1200 baud, it takes 5 seconds from pressing the button on the hand-held unit to receiving the confirmation LED. I originally had 2 second timeouts on the serin commands both ends, but found that to get the system to work reliably I had to increase these to 4 seconds.
Having got the unit working. I decided to see how far it would work, so I went for a walk around the village. I can confirm that it still works fine at over 400m (as far as I went - lunch was calling!). That was through other houses and gardens and over the top of a small rise, so not really line-of-site. I have no doubt that the claimed 1800m range line of sight is genuine, or that I could run at a much lower power and still have a reliable link for my purpose.
It'd be nice to know what's going on inside these units, though, as the transmission time is puzzling. Each 13 byte transmission should take a bit over 1/10th second (I think) and there are a total of five transmissions, with an inherent 1.5s delay in the software, so that means it should take around 2 seconds from button press to receipt of the LED confirmation, not 5 seconds. I'm guessing that the modules aren't actually transmitting over-the-air at 1200 baud, but may have buffering within the microcontroller that's on the board.
Anyway, I thought this update on performance was worth posting. Based on my findings I'd not bother with the HC-11 modules at all, unless you only need a very short range and are happy with a low baud rate (my guess is that the HC-11s will work better with a lower baud rate when I get around to doing some proper testing). If you want cheap and reliable long range links, then the HC-12 is hard to beat. They are cheap (less than £3.20 each including the antenna and shipping) they don't give out any spurious data (so they don't upset the serin command) and they seem easy to use.
More will follow when I've had some time to make some test units up for proper range testing.