Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 20:38 12 Jul 2020 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : HC-12 Wireless Serial Module

     Page 1 of 8    
Author Message
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 1582
Posted: 06:27pm 11 Jan 2016
Copy link to clipboard 
Print this post

hi,
for anyone who is interested, attached is a copy of an HC-12 graphical configuration utility i've been working on. i have also edited the HC-12 user manual into a more 'english' form that is hopefully a little more understandable.

the HC-12 module can be had for less than us$10 (including delivery) for a pair on ebay. of note is that configuration is saved in onboard flash, so you can configure a pair of modules once and thereafter pretty much treat them as a 3-wire TTL serial data cable that can be up to 1800m long (on a good day with a tail wind).

feedback and corrections to any errors are welcome.


cheers,
rob :-)




2016-01-12_042418_HC12_config.zip
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 3429
Posted: 09:26pm 11 Jan 2016
Copy link to clipboard 
Print this post

I don't have any HC12's yet but when they arrive, your utility will make life easier.
It leaves more time for the interesting stuff.

Thanks
Jim
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 2680
Posted: 09:42pm 11 Jan 2016
Copy link to clipboard 
Print this post

For US$10 a pair that is a cheap serial communication link. Using your utility and being able to treat them as a simple serial link makes it so convenient.

I am amazed at the products that come out of China. They are often very good but at the same time tragically crippled by their documentation.
Geoff Graham - http://geoffg.net
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 708
Posted: 01:51am 12 Jan 2016
Copy link to clipboard 
Print this post

Thanks Rob for your fine configuration utility program..! Setting up the radios will be much easier now...
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 02:22am 12 Jan 2016
Copy link to clipboard 
Print this post

Great job Rob!
A simple to use utility that prevents a lot of headaches. Works great!
I am using it now with my USB-Serial module and have a console to a uMite open.

Microblocks. Build with logic.
 
Grogster

Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 7216
Posted: 02:27am 12 Jan 2016
Copy link to clipboard 
Print this post

You can't select above channel 4(434.6MHz) - is that by design?

I am guessing you wrote the utility, to not allow setting of illegal frequencies for our Australian/New Zealand regulations, but that also means that other people from other countries can't select a frequency that they might be able to use.

I don't care, cos I stick to the regs, but others might need that flexibility.

Nice easy to use utility, Rob, and I think I might even get in a couple of those modules to play with. I don't suppose you know what the spectral cleanliness is like on these modules? I have a 2GHz spectrum analyzer, so I can check the carrier for harmonics, especially at the 100mW power...
Smoke makes things work. When the smoke gets out, it stops!
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 1582
Posted: 02:39am 12 Jan 2016
Copy link to clipboard 
Print this post

  Grogster said   You can't select above channel 4(434.6MHz) - is that by design?


you see that little check box marked "LPD433 lock"? try unchecking it

i would be extremely interested in any RF testing folks could do, so as to be able to expand on the user manual. also, please do report any spelling errors spotted (in config utility and user manual). i'm already up to version 2.3B of the manual after re-reading it a few times.

i am also keen to hear how well the serial port enumeration works. i'm reading the windows registry to build the list of ports and am not 100% sure how well it detects real serial ports.


cheers,
rob :-)
 
Grogster

Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 7216
Posted: 02:58am 12 Jan 2016
Copy link to clipboard 
Print this post

D'OH!

My bad - I wondered about that checkbox, but did not think to untick it - silly boy.(me, that is)

Looking at the photo of the module in your manual, it looks to have some kind of output RF filtering, but how good or bad it is, does depend on what the spectrum analyser makes of it. I will get a couple in from eBay and hook one up and post the resultant waveform + any other data. This is not exactly lab-testing that is done for compliance, but it would give us some kind of idea of it's spectral output purity.

Edited by Grogster 2016-01-13
Smoke makes things work. When the smoke gets out, it stops!
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 3429
Posted: 10:14am 12 Jan 2016
Copy link to clipboard 
Print this post

  robert.rozee said  
i am also keen to hear how well the serial port enumeration works. i'm reading the windows registry to build the list of ports and am not 100% sure how well it detects real serial ports.


cheers,
rob :-)


Finding real serial ports cam be a pain at times.
This is the routine that MMEdit uses (Windows only)


' _OPEN_EXISTING = 3

' _INVALID_HANDLE_VALUE = -1 ' signed INT64 FFFFFFFF
' _INVALID_HANDLE_VALUE = 4294967295 ' unsigned

redim portlist$(65)
pf=0
for PortNumber = 1 to 64
lpFileName$ = "\\.\COM"; PortNumber
dwCreationDistribution = _OPEN_EXISTING
hTemplateFile = _NULL
calldll #kernel32, "CreateFileA", _
lpFileName$ as ptr, _
dwDesiredAccess as ulong, _
dwShareMode as ulong, _
lpSecurityAttributes as ulong, _
dwCreationDistribution as ulong, _
dwFlagsAndAttributes as ulong, _
hTemplateFile as ulong, _
hFileHandle as ulong

if hFileHandle <> _INVALID_HANDLE_VALUE then
pf=pf+1
portlist$(pf)=mid$(lpFileName$,5)
calldll #kernel32, "CloseHandle", _
hFileHandle as ulong, _
result as long
print lpFileName$
end if
next PortNumber


Jim
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 1582
Posted: 04:28am 13 Jan 2016
Copy link to clipboard 
Print this post

  TassyJim said  
Finding real serial ports cam be a pain at times.
This is the routine that MMEdit uses (Windows only)


for PortNumber = 1 to 64
lpFileName$ = "\\.\COM"; PortNumber
dwCreationDistribution = _OPEN_EXISTING
hTemplateFile = _NULL
calldll #kernel32, "CreateFileA", _



what sort of time delay do you see from using this method? it does seem like there are a number of approaches, all quite different, and all having varying (non-overlapping) degrees of success. i just did another search with google and found the only universal answer to the question, is that there is no universal method!

i do like the simplicity of your method, but it does have a couple of caveats with higher port numbers, the possibility of ports not named COMn, and apparently some bluetooth devices masquerading as comm port devices when they are not.

i used the registry approach mainly because delphi 5 (the rather ancient RAD environment i use) has quite nice support for accessing the registry.


cheers,
rob :-)
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 3429
Posted: 10:58am 13 Jan 2016
Copy link to clipboard 
Print this post

Hi Rob,
My method is slow, especially if you go looking for 64 ports.
It does only find ports that are not in use. That may be an advantage.
It does find the old COM1 etc, not just USB ports.
(It finds the modem built in to my laptop)

I am also playing with a port monitor to listen for the Windows messages when USB devices are inserted/removed. That also has problems with some serial ports.

TeraTerm seems to have a fast and reliable method but I haven't work it out yet.

Jim
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm
 
HankR
Senior Member

Joined: 02/01/2015
Location: United States
Posts: 209
Posted: 03:30pm 13 Jan 2016
Copy link to clipboard 
Print this post

  robert.rozee said   feedback and corrections to any errors are welcome.


Rob,

Your work in creating a config. utility will help a ton.

As far as the documentation goes, I have questions or suggestions for revisions on just about every one of the 8 pages.

Just about all of it involves improvements that could be made to the original language which is kind of awkward in many places and which you might not have wanted to bother to fiddling around with.

I might just do a rewrite myself and send it to you to see if I've got it right.

Hank
 
HankR
Senior Member

Joined: 02/01/2015
Location: United States
Posts: 209
Posted: 03:56pm 13 Jan 2016
Copy link to clipboard 
Print this post

  Grogster said  
Nice easy to use utility, Rob, and I think I might even get in a couple of those modules to play with.


Grogs,

I've been interested in this class of devices ever since the HC-11 was the subject of a pretty fast and furious thread back in April/May 2015 that burned out around the time Banda, who had been looking for help with wireless and the HC-11, sent you a pair to try to get working.

In fact, I had ordered a set from ebay back then but have still not got around to hooking them up.

I believe the interface is either very similar at the least, and may be virtually identical to the HC-12, the only important difference being the HC-11 is lower powered than the HC-12, but it uses less power, too.

What ever happened with those HC-11s and did you have any luck with them? There's someone on youtube who shows how he got them working with a GPS data feed:

http://www.youtube.com/watch?v=7lo-mLMAezo

Been meaning for a while to bring this up again, and Rob gave me the inspiration to finally do it.

Hank
 
HankR
Senior Member

Joined: 02/01/2015
Location: United States
Posts: 209
Posted: 04:17pm 13 Jan 2016
Copy link to clipboard 
Print this post

HC-11 module uses TI CC1101 RF Transceiver IC; max. RF out +12 dBm

HC-12 module uses Silicon Labs RF Transceiver IC; max RF out +20 dBm


I lost quite a few of my datasheets and user manuals to a laptop HD failure, so will have to retrieve the HC-11 user manual (I think also at SEEED and other places), but I recognize some or all of the same confusing "FU" modes as described in Rob's enhanced user manual for the HC-12. Likely the same interface designer behind both products.

Hank
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 1582
Posted: 02:43am 14 Jan 2016
Copy link to clipboard 
Print this post

  TassyJim said  
TeraTerm seems to have a fast and reliable method but I haven't work it out yet.


this page mentions teraterm's comm port detection method:
http://stackoverflow.com/questions/1205383/listing-serial-com-ports-on-windows

and provides a link to the source:
https://en.osdn.jp/projects/ttssh2/svn/view/trunk/teraterm/ttpcmn/ttcmn.c?view=markup&root=ttssh2

all i can say is, it looks complicated! as far as i can see, it may well be a combination of more that one approach, including QueryDosDeviceA and accessing the registry.


here is a revised (2.3B) version of the datasheet:
2016-01-14_122335_HC-12_v2.3B.pdf

i'll have a look at the HC-11 user manual and see if i can easily create a variant of the confugration utility for it. at first glance, while there are a number of AT commands shared, there are some that are different.
AT+Bxxxx, AT+FUx, AT+Cxxx, AT+RX all seem the same as for the HC-12
AT+Px is the same format, but x corresponds to a different set of power levels
AT+Ups is a different format, with number of data bits not adjustable
AT+Axxx is a new command to set an address
AT+RESET is used instead of AT+DEFAULT


cheers,
rob :-)
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 1582
Posted: 05:47am 15 Jan 2016
Copy link to clipboard 
Print this post

and here we have it, an HC-11 configuration utility:
2016-01-15_155359_HC-11_config.zip

plus a minor revision of the HC-12 configuration utility:
2016-01-15_154000_HC-12_config.zip

note that i don't have any HC-11 modules, so have just worked from the HC-11 datasheet. mode FU2 is limited to 4800bps, with the others having no limitations applied. there is no reference i can find to the exact operating frequency of the various channels, so the LPD433 lock and frequency display have been removed.

once correct operation of both has been verified by others, i'll post the sources on github. btw, running with no HX-1X attached, the send button will reveal the config strings being sent out.


cheers,
rob :-)

edit: adjusted the HC-11 max channel from 128 down to 127. replaced zip file.
Edited by robert.rozee 2016-01-16
 
Grogster

Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 7216
Posted: 06:01am 15 Jan 2016
Copy link to clipboard 
Print this post

  HankR said  What ever happened with those HC-11s and did you have any luck with them?


No, not with the PIC32 chips anyway.

No matter what I did, they would simply not respond on a Micromite or any other PIC32 based device including a Maximite.

They DID respond and work just fine on an 8-bit PICAXE chip, so there is something very odd going on there, and I never found out what the actual cause really was.

Serial is serial is serial, so as long as the baudrate is correct and the stop/start bits and parity are correct, then anything should work on anything. The HC11's were the first module I have come across that seemed to be MCU-selective!

I gave up on those modules and advised Banda to use something else.
I think I was even going to send him some of my spare SunrayRF modules, but I don't think I got around to that either - Banda, if you are reading this, PM or email me to remind me where we got up to in that department.
Smoke makes things work. When the smoke gets out, it stops!
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 06:24am 15 Jan 2016
Copy link to clipboard 
Print this post

Is the serial not inverted on the PICAxe?

Microblocks. Build with logic.
 
HankR
Senior Member

Joined: 02/01/2015
Location: United States
Posts: 209
Posted: 10:46am 15 Jan 2016
Copy link to clipboard 
Print this post

  MicroBlocks said   Is the serial not inverted on the PICAxe?


I just checked the PICAXE reference and the serial in and serial out can be set to inverted or true by PICAXE Basic language command -- and it appears that the in and out polarity (and speed) can be commanded independently.

Programming serial input and output are inverted from ordinary RS-232 levels and that arrangement is fixed and can't be changed

Hank
 
Grogster

Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 7216
Posted: 05:10pm 15 Jan 2016
Copy link to clipboard 
Print this post

I tried true-type-logic(TTL), that being SEROUT B.0,T2400,("Hello world.") kind of syntax for the PICAXE. I cannot remember if I used inverted on the PICAXE, but probably not, as if it worked with TTL....

That command being SEROUT B.0,N2400,("Hello world.") kind of thing.

However, as the Maximite and MicroMite series of MCU's are TTL, it should have worked right out of the box with them too. I note that with the recent firmwares, you can now also specify the MM invert the data, but at the time, I was not using that option, and it may not have been available either.

EDIT: I found the YT video about this issue:





Link to the video. Edited by Grogster 2016-01-17
Smoke makes things work. When the smoke gets out, it stops!
 
     Page 1 of 8    
Print this page
© JAQ Software 2020