## Re: REMOTING SIX SENSORS ON ONE TWISTED PAIR - PART 9

Post any questions you may have about our current range of USB data loggers
Glovisol
Posts: 0
Joined: Sat May 11, 2013 10:03 am
Location: San Marzano Oliveto, Asti, Italy

### Re: REMOTING SIX SENSORS ON ONE TWISTED PAIR - PART 9

INCREASING RS485 POTENTIAL TRANSIT RESOLUTION FROM 8 to 16 BIT

With reference to Part 3, PLANNING STRATEGY, paragraph 3.5, RESOLUTION, it was correctly stated that Arduino’s SoftwareSerial library has a 1 Byte, 8 Bit transmission capability. With a 2.5 V External Reference:

Resolution: 2500/254 = 9.84 mV

However Resolution can be dramatically increased by a simple software modification, as suggested in “Arduino Cookbook”, paragraph 4.6. The idea is to encode the datum to be transmitted into TWO Bytes and then transmit the two Bytes one after the other. Since each Byte comprises 8 Bits, with two Bytes we have a 16 Bit capability, or:

Resolution: 2500 / (254 * 254) = 2500 / 2^16 = 2500 / 4095 = 0.61 mV

This is a potential Resolution. The Arduino 1 Micro Analog Inputs have a 10 bit resolution, therefore the Sensor voltage is sampled at:

Resolution: 2500 / 1023 = 2.44 mV and this is the maximum we can achieve with this device.

To conclude, with the new sketch we do not degrade the Micro input Resolution in transmission and can translate the Data outputs from the Sensors at a resolution of 2.44 mV: a big improvement with respect to 9.8 mV! Unfortunately this Resolution is applicable to the transmission only, because the Resolution of Arduino 1 outputs is still at 8 bits. In other words it will be possible to use this improved Resolution only when suitable documentation (and a better working IDE) for Arduino M0 will become available, but at least we are prepared.

Integer datum manipulation is done by dividing it into two integer parts: a High Byte and a Low Byte. The High Byte contains the number of times 255 fits into the integer, the LowByte contains the remainder.

Example 1
10 Bit Resolution : 2.44mV
Sensor voltage: 1860 mV
Binary: 1860/2.44 = 761
Hi/Lo Byte: 761/255 = 2 + 251
High Byte = 2
Low Byte = 251

Example 2
10 Bit Resolution : 2.44mV
Sensor voltage: 426 mV
Binary: 426/2.44 = 175
Hi/Lo Byte: 175/255 = 0 + 175
High Byte = 0
Low Byte = 175

At present in the lab Master and Slave work with the two newly built Screens (see Part EIGHT) and the Reference voltage is 2.5 V. Sync Byte has been changed from 123 to 255 to check for possible interference between Sync Byte and High Bytes. The new High Resolution Master and Slave DEMO sketches (one channel only) are enclosed, as well as Screens demonstrating System operation.
Attachments
Sketch_SLAVE_485_9_DEMO.doc