HC-11 and HC-12 transceiver modules

Buzby

Senior Member
Why, at the end of the loop, is "LRC = $FF - LRC + 1" preferable to just LRC?
Because in the receiver you just need to sum the data including the LRC, and check that the result is zero. It's a bit quicker and saves a variable.
 

AllyCat

Senior Member
Hi,

It is worth re-iterating ... the number of errors I have seen is minute.
If you feed "garbage" data (noise) into any 8-bit check field (be it using CRC, Add, XOR sums, etc.) then there is still at least a 1 in 256 (i.e. random) chance of the data being accepted as valid. I believe the advantage of a CRC is that it is much stronger in detecting a short burst of related errors, common in serial/wireless applications.

BTW the last three lines of Tex's LRC macro can be replaced by simply: @bptr = - LRC to save 8 bytes.

Cheers, Alan.
 

hippy

Technical Support
Staff member
I can't decide whether to go for a simple checksum, an LRC or a CRC ... and if the latter, which polynomial ?
The more bits used in the checksum the better, and likewise the higher the ratio of bits compared to the size of data in the payload. CRC will be better than LRC in providing greater immunity to multiple errors in the payload. Good polynomials have already been determined for various CRC sizes so it should just be a case of picking one of those.
 

techElder

Well-known member
Why, at the end of the loop, is "LRC = $FF - LRC + 1" preferable to just LRC?
You'll have to wait for the mathematics section of this forum for that answer! :D

The algorithm is straight from MODBUS when ASCII only is transmitted.
 

techElder

Well-known member
BTW the last three lines of Tex's LRC macro can be replaced by simply: @bptr = - LRC to save 8 bytes.
Too slow AllyCat, hippy already optimized the routine to one byte! :D

PS. Some code expansion is necessary for educational purposes. ;D
 

lbenson

Senior Member
re: Why, at the end of the loop, is "LRC = $FF - LRC + 1" preferable to just LRC?
Because in the receiver you just need to sum the data including the LRC, and check that the result is zero. It's a bit quicker and saves a variable.
Cool. Thank you.
 

ZOR

Senior Member
I want to use the HC-12 in a cast metal spotlight case (garden spot type) It will have pan/tilt electronics inside, however although getting good results with the small pcb coil spring antenna, it's going to be less reliable inside the case. Can someone tell me the type number of the antenna plug so I can put an external stub aerial on the case. Thanks
 

ZOR

Senior Member
Thanks hippy, hopefully now I know the socket reference is what you found, just need to find the plug, hopefully in UK. Regards
 

ZOR

Senior Member
Thanks inglewoodpete, I am looking ideally for an interconnect cable to external antenna. Is the ground side the middle pin then? Having difficulty in finding the plug to go in the IPEX20279-001E-03 standard RF socket. Will carry on googling. Regards
 

ZOR

Senior Member
Many thanks Jeremy, I just found this. don't know if correct?

http://www.ebay.co.uk/itm/SMA-Female-Plug-to-IPX-U-FL-Female-Pigtail-Cable-Antenna-WiFi-Network-PCI-UK/231098912466?_trksid=p5713.c100041.m2061&_trkparms=aid=333008&algo=RIC.MBE&ao=1&asc=20140109122350&meid=284cbfcbd8064bd5956f45f4d8fc8ad3&pid=100041&rk=1&rkt=35&sd=112279368288

Not as cheap as China, but will look around for UK seller cheaper if correct.

I have a 2.4g antenna (stub) but not knowing about RF can it be used, or do I have to look for short stub 433mhz one. Regards
 

Jeremy Harris

Senior Member
That's a standard SMA female and most of the 433MHz antennas I've seen "should" fit it, as they usually have a normal, rather than reversed polarity, SMA. The 2.4 GHz wifi antenna won't work at 433 MHz, as the VSWR will be too high and there's a risk that you may damage the module. You need to hunt around for a 433 MHz antenna, like this: http://www.ebay.co.uk/itm/433MHz-antenna-rubber-5cm-SMA-straight-UK-Seller-/132078399409?hash=item1ec07c6fb1:g:19MAAOSw44BYc4hv or this: http://www.ebay.co.uk/itm/433MHz-antenna-rubber-5cm-SMA-male-right-angled-UK-Seller-/132085768718?hash=item1ec0ece20e:g:5OsAAOSwaB5XuE0U
 

ZOR

Senior Member
I bought this 433mhz antenna, however is there a way to make the connector waterproof, other than using silicon, is there a rubber glove type cover? Thanks
 

Jeremy Harris

Senior Member
I bought this 433mhz antenna, however is there a way to make the connector waterproof, other than using silicon, is there a rubber glove type cover? Thanks
I've waterproofed one by fitting a bit of adhesive-lined heat shrink sleeving over it after fitting. It's been outside now for around 9 months and is still working well. I put a smear of silicone grease on the threads of the SMA, really just to reduce the slight risk of water creeping up them, but I'm not sure it was really needed. If you don't have any adhesive-lined heat shrink then I've found that you can cheat by using ordinary heat shrink with some thin slivers shaved from a hot melt glue stick poked inside. When the heat gun shrinks the sleeving it melts the glue and it runs all around the inside under the pressure of the stuff shrinking. Alternatively, wrapping a bit of self-amalgamating butyl tape around the base should do just as good a job, but won't look quite so neat.
 

manuka

Senior Member
ZOR: Connector weatherproofing often relates to budgets,ones local outdoor weather/temperature/salt spray environment & of course your need to eventually open the connection. Radio hams (who tend to continually erect/dismantle antenna !) have many "Hints & Tips".

FWIW - although they may LOOK great, many sturdy UHF rubber ducky antenna are no great performers. Some are almost a hollow mockery! Check this comparison & note their noise pickup, which could be an issue in low power data links. Impedance matching & coax. feedline losses can be significant issues too.

At 433 MHz soldered antenna connections to a simple ~165 mm whip, along with total circuitry encasement in a plastic box, may be preferable to rubber duckies. As at UHF height & near LoS can be everything, elevation of the setup usually gives GREATLY enhanced coverage & data link performance.

Stan- ZL2APS since 1966
 

ZOR

Senior Member
Many thanks both. I think I will go along with shrink wrap and silicone or hot melt glue. Best regards
 

premelec

Senior Member
great refs manuka! - however in reading various opinions of hams I didn't see silicone 'Rescue' self bonding tape mentioned and it seems to work way better than the old black plastic electrical stuff... the silicone stuff also takes way more heat... self welds...
 

srnet

Senior Member
! Check this comparison & note their noise pickup, which could be an issue in low power data links
I hope people realise that those are the results for a particular reciever, of no relavence to antennas in general, and could if followed damage some radio modules.

For instance a half wave or full wave end fed antenna has an insertion impedance of 1000R +, this large mismatch could destroy a radio transmitter modules intended for a close 50R match such as centre fed dipole or 1/4 wave end fed.
 

JPB33

Senior Member
Been following the HC-12 thread with great interest, taken the plunger and waiting for a pair to arrive. Never attemped using picaxe over rf before and got a couple of questions.

I've got the FTDI FT232RL USB board as per the thread, what type of USB cable plugs into the small socket for programming?

Does the HC-12 work "straight out of the box"?

Thanks Peter
 

PhilHornby

Senior Member
Some assembly required. Small parts unsuitable for children under 36 months!

In reverse order...

The HC-12's I have received are supplied as a small PCB, a spring and a strip of straight header pins. The 'spring' is the aerial and is required - range is only a few metres without it. Solder to the hole/pad marked "ANT". You'll only find one place where you can solder a strip of header pins :)

Personally, I don't pre-program the HC-12 using a PC ... I include the initialisation code in the PICAXE program ... see here: http://www.picaxeforum.co.uk/showthread.php?29089-Demonstration-of-HC-12-radio-module-configuration
 
Last edited:

manuka

Senior Member
JPB33: Re
Does the HC-12 work "straight out of the box"?
I've no factory fresh HC-12 on hand for confirmation,but recall my Satisfy Electronics swag came set to Ch. 001 (433.4 MHz), 9600 bps, FU3 mode & NZ/Aus. compliant 20mW TX power. The TX power however may have been an illegal 20dBm (=100 mW)! Power adjustment should hence be made to respect UK's 10mW limit...

Fellow Kiwi Rob. Rozee's user friendly GUI is highly recommended for HC-12 config & tweaks - Satisfy Electronics also supply very cheap (~US$1.40 with free intl. p&p!) USB-TTL flying lead adapters - pictured.

EXTRA: Although it's Arduino slanted, this All-About-Circuits site has VERY helpful HC-12 insights. Stan.
 

Attachments

Last edited:

ZOR

Senior Member
Thanks manuka & premelec "Power adjustment should hence be made to respect UK's 10mW limit..."

There was me thinking this device was so good transmitting through walls of the house to an external Pan/Tilt camera, that now I find it's output is default at 100mw. Every 6db reduction of that will produce half the distance output. As it will be used so infrequently to move the position of a security camera, I wonder what chances would be getting traced or causing problems elsewhere. Will I unlock all car doors in the area (laugh) . I remember how badly pirate radio stations were traced. Don't fancy taking down from the wall to tweak power.

EDIT: Just realised after waking up, the receivers up the wall so the transmit end could be tweaked to see what goes.
 

JPB33

Senior Member
Thanks I've ordered the leads and point noted about the power, I've also downloaded the configuration GUI so will be able to adjust as its only short range initially to get it working. I had aready downloaded and read the data sheet and its becoming almost understandable!

It has a loopback test shown in the data, seem to remember using something similar on other equipment when dishes were being aligned to confirm los?
 

PhilHornby

Senior Member
As well as ignoring the advice in the link mentioned in #181, do not, even for a shortwhile, operate modules of this type withouts an antenna.
The module that I accidentally ripped the 'spring' off (Post #148), has been in use (on FULL power), for the past two months. Not a course of action I would recommend - but it's not killed it either.
 

JPB33

Senior Member
I'm still eagerly waiting for my HC-12 to find the UK. In anticipation looking for something simple to try when they arrive I see a similar question has been asked in #106 with a reply in #107 and report of success in #108.

Pasting the code from #107 into PE6 just produces the syntax error report below which I cannot clear, can anyone throw some light on whats wrong or guide me to some simple sample code to try when they arrive?

Sorry to ask what must be a boring question but its driving me nuts!

Thanks Peter

symbol baud = T9600_4 ;set baud rate for Tx and Rx
^
Syntax error on line 7 at/before position 14

Error: Unknown symbol - T9600_4
 

Jeremy Harris

Senior Member
As an additional observation, if using 9600 baud then it's best to up the clock to 16MHz, especially when interfacing with devices that expect reasonably accurate baud rate timing, like these transceivers. The Picaxe software serial port baud rates seem to be off a bit at some clock frequencies, and some devices are sensitive to this, especially if a fairly long data string is sent. My usual rule-of-thumb when using a software serial port to talk to another device at 9600 baud is to run the Picaxe at 16MHz and break up data transmissions into no more than about a dozen bytes at one go.
 

The bear

Senior Member
Thank you for your replies to Post #190.

I'm working in conjunction my friend JPB33.
Its a case of the blind leading the blind. We are both very interested in the HC-12, thanks to the various knowledgeable forum members.

However, it doesn't answer the question. I appreciate we are trying to run, before we can walk (Old Anglo-saxon saying).

What is required, is just a few lines (hippy style) to get us started. Transmit and receive in its simplest form. (Using 08M2 and/or 14M2).

Regards, Bear..
 

manuka

Senior Member
The bear/JPB33: Even 08M2 & simple code are quite capable of handling HC-12, but to avoid Forum response repetition perhaps first inform-
* Have you read thru' all 193 (!) postings so far?
* Are you using Rob. Rozee's config. GUI ?
* Which FU setting is intended?
* Aside from stabler data, are you aware the best RX sensitivity comes with the slowest data rate ?
* Your local UHF environment - urban clutter & interference or rural ?
* Suggest you provide layout picture(s) & circuit diagram(s) of your setup !
* What you eventually hope to do with the HC-12?

Stan.
 

Jeremy Harris

Senior Member
Thank you for your replies to Post #190.

I'm working in conjunction my friend JPB33.
Its a case of the blind leading the blind. We are both very interested in the HC-12, thanks to the various knowledgeable forum members.

However, it doesn't answer the question. I appreciate we are trying to run, before we can walk (Old Anglo-saxon saying).

What is required, is just a few lines (hippy style) to get us started. Transmit and receive in its simplest form. (Using 08M2 and/or 14M2).

Regards, Bear..
The Picaxe code is dead simple, just use serout to transmit bytes of data and serin to receive them. All you need to know, as far as the Picaxe code is concerned, are the pins that are connected to the Tx and Rx connections on the HC-12 and the baud rate. The examples in Picaxe manual 2 under serin and serout will then be all you need in order to send and receive data via a pair of HC-12s.

As above, to be legal in the UK you do need to set up the HC-12 modules, and you can either do this using an extra connection to the HC-12 and some Picaxe code, or you can do it very quickly and easily using an FTDI, or similar, USB to TTL level serial adapter and a set of patch leads, plus the very useful configuration tool that Rob Rozee has created (there are download links earlier in this thread, and some code examples, too, I think).
 

JPB33

Senior Member
Thanks for the replies and info, very encouraging. Read the posts a few times as they have evolved and plan to use the Rob Rozee tool to set the o/p down also play with the baud rate, only want to communicate about 50yds anyway. We are rural so dont expect co-channel interferance. Got the FTDI but not the cable.

Never used rf or even communicated between picaxe's so its another leap into the dark for us hence the questions before the HC-12's land on the doormat. Was hoping to be able to switch a remote relay on/off and also receive the date from a display on another project which seems to be 67 bytes long,

Do the units work as simplex or have they got to be used half duplex also the info says unlimited data but others say only a few bytes?

Dont suppose its possible to simulate any of this?, can two picaxe communicate serially hardwired, the info seems to imply that the HC-12 just replaces a serial link?

This is what I hope to display?

Thanks Peter

serout C.4, N2400, (254,128,b24,b25,b26,b27, " Holiday ")'Display Aerate time
serout C.4, N2400, (254,192, "Set 7200 Secs ")'Display Aerate time
 

premelec

Senior Member
I'm close to firing two HC12s up - please confirm that I can put config commands [after delay] at beginning of PICAXE program with SET pin pulled down to reconfigure HC12s for lower power and baud etc before powering [in accord with ] instructions. Then keep SET pin high for future program starts so only the before and after delays occur but HC12s aren't affected until SET pulled low and restart..... This would be to reconfigure in the field by selecting various configure subroutines using an ADC pin value... Does this sound Ok? Or nuts... ;-0
 

premelec

Senior Member
Hi Phil - thanks for that - there is so much information here and Backshed etc on HC12 I've got lost in the info forest and I'm hoping to cut down a few trees to make a decent cabin [so to speak...].... ;-0
 
Top