A first play today....
First up - using a UART doesn't work (needs inverting) - so I did a small transmit that uses TMR2 to generate 4000Hz (250uS) timing.
It's a little 'clunky' at present - data is put into 'buf' and 'length' set to it's length (in bits) - the data needs to include the 0xAA or 0x55 AGC bits - but because it is Manchester encoded - this is actually done as 0xFF (two bytes of 0x0b0101010101) or 0x00 (two bytes of 0b10101010) -n encoding gives 0 -> 0b10 and 1 -> 0b01 (which makes decoding the signal easier (maybe))
This doesn't do decoding (yet) - need to pull another Arduino.
This code is Arduino specific (there is a custom interrupt to get a 4kHz timing)
So - something to try out. I found an aerial helped (and I just poked a jumper through the relevant holes - solder later!)
Showing 'sent' and 'received' by connecting the data pins of the transmitter and receiver to a logic analyser (which works better than a scope - the signal is rather noisy)
Martin
Wireless module!
-
mnfisher
- Valued Contributor
- Posts: 2074
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 162 times
- Been thanked: 958 times
-
mnfisher
- Valued Contributor
- Posts: 2074
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 162 times
- Been thanked: 958 times
Re: Wireless module!
So - split into two programs - a 'sender' (ASK) and a 'receiver' (ASK_DEC) - I wrote a small macro Send that transmits a string (keep it < 20 characters or so - short messages should work better - I've not tested longer strings, although buf has 128 bytes (and 7 are used for AGC, magic, length, 0 and CRC)) It also adds a checksum - but it is ignored here.
The data send is {0xFF, 0xFF /* Synchronisation / AGC bytes */, 0x2DD4, /* Magic number for transmission */ number_bytes, str_data, CRC }
Note that here I've included the /0 termination character of the string.
The receiver 'looks' for the magic number (this could be tailored for multiple targets) then gets the number of characters to read. Reads 'n' characters - It should calculate the CRC and drop bad blocks. It outputs the string received to UART
It's still rather clunky and there is some extraneous 'debug' code (or not?) - but transmission seems reliable at a few inches distance - someone might like to test over some longer ranges. I'll have to solder the antenna first
If the range is good (enough) then it would be worth continuing and refining - but if it's only a few inches (or feet) then maybe not worth the time?
Martin
The data send is {0xFF, 0xFF /* Synchronisation / AGC bytes */, 0x2DD4, /* Magic number for transmission */ number_bytes, str_data, CRC }
Note that here I've included the /0 termination character of the string.
The receiver 'looks' for the magic number (this could be tailored for multiple targets) then gets the number of characters to read. Reads 'n' characters - It should calculate the CRC and drop bad blocks. It outputs the string received to UART
It's still rather clunky and there is some extraneous 'debug' code (or not?) - but transmission seems reliable at a few inches distance - someone might like to test over some longer ranges. I'll have to solder the antenna first
If the range is good (enough) then it would be worth continuing and refining - but if it's only a few inches (or feet) then maybe not worth the time?
Martin
- Attachments
-
- ask.fcfx
- (14.23 KiB) Downloaded 9 times
-
- ask_dec.fcfx
- (23.78 KiB) Downloaded 10 times
-
jgu1
- Posts: 931
- Joined: Thu Dec 03, 2020 8:25 pm
- Location: Denmark
- Has thanked: 839 times
- Been thanked: 205 times
Re: Wireless module!
Thank you, Martin.
Could you please explain what I need to do to test it? I would be happy to help with testing.
For me, your program is a little difficult to understand, but I can connect it to two Arduinos and try and test with longer distance it out if you can guide me through the setup.
Could you please explain what I need to do to test it? I would be happy to help with testing.
For me, your program is a little difficult to understand, but I can connect it to two Arduinos and try and test with longer distance it out if you can guide me through the setup.
-
mnfisher
- Valued Contributor
- Posts: 2074
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 162 times
- Been thanked: 958 times
Re: Wireless module!
Hi Jorgen,
Thank you - the ASK Arduino needs to be connected to the transmitter. Connect gnd, 5v (or more for longer range up to 12v - proceed with care!) and the data pin to the TX pin (in properties) i used d6...
The ask_dec Arduino connect to the receiver - ground, 5v (max) and data (either pin) to d3.
The receiver also needs to be connected to a pc and open a com port in putty at 115200 baud.
The transmitter sends 'hello world [number]' where number increments and this should be output to putty by the receiver...
I notice there are better quality versions with a crystal rather than a tuned coil..
I found that moving the transmitter to the kitchen meant that reception was poor unless i fiddled with the antenna (which still aren't soldered) i suspect having a rigid vertical antenna should improve things dramatically (instead of the current jumper wire!)
Martin
Thank you - the ASK Arduino needs to be connected to the transmitter. Connect gnd, 5v (or more for longer range up to 12v - proceed with care!) and the data pin to the TX pin (in properties) i used d6...
The ask_dec Arduino connect to the receiver - ground, 5v (max) and data (either pin) to d3.
The receiver also needs to be connected to a pc and open a com port in putty at 115200 baud.
The transmitter sends 'hello world [number]' where number increments and this should be output to putty by the receiver...
I notice there are better quality versions with a crystal rather than a tuned coil..
I found that moving the transmitter to the kitchen meant that reception was poor unless i fiddled with the antenna (which still aren't soldered) i suspect having a rigid vertical antenna should improve things dramatically (instead of the current jumper wire!)
Martin
-
mnfisher
- Valued Contributor
- Posts: 2074
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 162 times
- Been thanked: 958 times
Re: Wireless module!
No worries... I might solder a board up and have a test myself this weekend (although at the moment the sun is shining - soni might be led luted outdoors...)
Martin
Martin