SimonH Sun Oct 24, 2021 10:49 pm
my code at work was taking ages to download so I did some thinking in work mode about using Rf modules with a few thoughts, applogies if you already know this.....
I think most 'clever' thechiques for allowing multiple users in the same RF channel rely on being able to muck about with the Rf signals, but that wouldn't be possible if the RF module just allows a straight digital modulation, but say we want 8 channels x 10 bit reolution digital data plus a bit more for device ID (for binding) etc. so say 100 bits per frame, and say we have 4kbits/sec bandwidth (in theory 4kHz should support 8kbits/sec, but you'l see why in a bit) and say we can accept at least 5 frames per sec. that gives 500 bits/sec out of a capacity of 4,000. That in theory that would allow 8 users to share if they could be synchronised in time. That could be done, but there would have to be a complex protocol that all users adopt to allow the designation of a master, and each transmitter would need a receive channel to monitor what is going on.
A simpler alternative would be to drop the user count to say 3 or 4 and allow statistics to take over so that on average enough messages get through. Probably OK for slow models, probably rubbish for say aeroplonks. Ideally each user would transmit at a different frame interval so no 2 get synchronised together, or more easily, a random element to the frame rate is included, so that avergae frame rate is acceptable, but each frame is at a different time interval from the one before.
Given a burst type of data frame/packet we need a coding system that supports that, and one ideal candidate is manchester encoding. This codes each bit such that there is a level transition in the mddle of each bit, and with a peramble/header of a number of '1' or a number of '0' generates a squarewave at the start. The down side is that it needs more bandwidth, hence dropping down to 4kbits/sec.
A good description is on the Atmel website
Also, there is an arduino compatible library that implements this system on GitHub
This is not quite useable 'as is' as it is based on 8 bit data and we want say 127 bits (again you'll see why 127 in a bit), but it looks as if the code could be modified.
The down side is that the Tx & Rx must have stable clocks so that the drift is not too great but if based on an xtal clock this should be do-able.
The next problem is data integrity to detect errors and prevent dodgy values getting to servos.
This could be addressed by using Hamming codes, that basically add extra parity bits and if enough are added in the correct places that they are capable of not only detecting errors but actually correcting them. See the web site
In particular note the SECDED system common in computers and Hamming(127,120) that expands 120 data bits to 127 bits by adding 7 parity bits, SECDED standing for 'single error correction, double error detection'.
I haven't found any adruino code that directly does this encoding/deoding but there are various algorthms to look at.
One issue with hamming codes is thay have to have frame/data blocks of 15, 31, 63, 127, 255 etc, bits so whilst 127 may be considered a bit OTT the next one down at 63 bits (57 bit user data) is probably too small, by the time you allow for say a 8-bit device ID, but is perfectly feasible for say 4 channel x 8-bit data.
These techniques should be able to cope with ocassionaly message corruption, but I doubt any system could cope with a continuous interferrer in an RF channel.
I must admit I have no idea what the actual error rate would be, but if Hamming does not give enough then other codes have more error correction, but at the expense of complexity and/or bigger overhead.
Binding could be done automaticaaly by sending the Rx to 'binding mode' on power up that waits for a defined message containing the device ID sent by the Tx when a button is pressed, but I would go for a simple retary hex switch(es) in the Rx & Tx, though it does require Rx access to change it, and extra space on the Rx PCB.
I've not used digital code servos, but changing from what is basically the analogue voltage on a joystick pot to whatever code shouldn't be too complex. I'm using a Adafruit PCA9685 16-Channel Servo Driver to offload the PWM generation, but I know some do it all in s/ware.
A (much) more complex system could be based on transmitting the same message/frame data on multiple RF channels, either at the same time (needs multiple RF modules) and/or by repeating the data after changing the frequency (limited by the time required to re-tune the Tx & Rx). You then sample the Rx data on all channels and do a time based comparison, and assume that all data points that agree are the wanted data and the rest is noise. Hopefully you have enough data to re-create the wanted message, but you would have to be able store and compare a lot of data points.
Either way you would be spreading across more than 1 RF channel so possibly not acceptable regulatory wise (any commercial system would have to meet any regulations in full in each territory). You could repeat the data on the same RF channel multiple times, but you'd need an accurate time base to allow the time based comparison to work, and of course lots of data storage, probably multiple data points per data bit per repetition. Of course if you repeat the data you reduce the number of users per RF channel (or reduced data rate), but if you limit to 1 user than you might not need the error correction!
Enjoy trying it!
Wed Jun 07, 2023 1:59 pm by david f
» Servo Depth controller
Mon Jun 05, 2023 1:03 am by geofrancis
» WW2 mini sub build
Sun Jun 04, 2023 4:56 pm by SimonH
» Waterproof servos
Sat Jun 03, 2023 10:02 am by geofrancis
» Robbe Seawolf V2
Sun May 28, 2023 1:25 pm by geofrancis
» BEC - Switch mode
Mon May 22, 2023 11:28 am by geofrancis
» Cheap Arduino Auto leveler
Sat May 13, 2023 11:23 am by C-3PO
» Pump for bladder system
Wed May 10, 2023 10:34 pm by tsenecal
» Wireless charging
Wed May 10, 2023 9:14 pm by geofrancis