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
https://ww1.microchip.com/downloads/en/AppNotes/Atmel-9164-Manchester-Coding-Basics_Application-Note.pdf
Also, there is an arduino compatible library that implements this system on GitHub
mchr3k/arduino-libs-manchester
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
https://en.wikipedia.org/wiki/Hamming_code
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 Dec 04, 2024 7:26 am by geofrancis
» Robbe Seawolf V2
Wed Dec 04, 2024 7:17 am by geofrancis
» Futaba -868/915mhz equipment
Tue Oct 29, 2024 4:46 pm by tsenecal
» RC Drift Gyro for pitch control
Sun Oct 20, 2024 2:04 pm by geofrancis
» WW2 mini sub build
Thu Oct 17, 2024 2:34 pm by geofrancis
» sonar data link
Mon Oct 14, 2024 4:31 pm by geofrancis
» ExpressLRS - 868/915 Mhz equipment
Fri Oct 11, 2024 8:58 pm by Marylandradiosailor
» Flight controllers as sub levelers
Fri Oct 11, 2024 8:14 pm by geofrancis
» 868/915 Mhz as a viable frequency for submarines.
Thu Oct 10, 2024 3:21 am by tsenecal