# Need help with designing 700m-range telemetry system

Status
Not open for further replies.

#### DrWhoF

700m telemetry

I need to design and build telemetry system to control a device 700m apart.
At both ends I need 4 digital inputs, 4 digital outputs, 1 analog input (0-5V) and 1 analog output (0-5V).
In addition I need to read rotary encoder with 2 signals shifted by 90°, convert it to distance and send through telemetry to the other end.
Any ideas are welcome.

#### throwaway18

700m telemetry

Data rate, maximum latency?

Straightforward with a cable. A microcontroller of your choice and an RS485 tx/rx chip such as max485.
PC with a RS232 to 485 converter at the ohter end or
another uC.

### DrWhoF

Points: 2

#### IanP

Re: 700m telemetry

Actually, I think they are good candidates for applications like yours, as they have 10-bit-A/D and DI/Os, and on top of that they are very easily to program in the good, old BASIC .. one drawback is that they will be not very fast, but I think in telemetry systems not always one needs millions of operations per second ..

Please give more details on how are you going to transmit data from one and to the other ..

Regards,
IanP

### DrWhoF

Points: 2

#### DrWhoF

Re: 700m telemetry

Top and bottom ends should be based on microcontrollers and I like the idea of using PICAXE. I can get PICAXE-08 or PICAXE-18.
Communication will go through twisted pair - it has to be isolated RS-485.
Speed: not higher than 4800bps.
Bottom and will be supplied from 24Vdc.
Top end can have any supply.

#### IanP

Re: 700m telemetry

If I may suggest something, PICAXE-08 or 08M are to small (only 5 I/O pins and 40/80 memory lines), PICAXE-18A is also small, as far as the memory is concerned, and has only 8-bit ADC ..
Go for PICAXE-18X .. and it looks like for your "bottom" end you will need 2 of them: one for rotary encoder and the other one for DIOs, A/D, D/A (has to be external IC) and communication ..

The RS-485 can be isolated by optocouplers, and there are nice units which take TTL/CMOS on both sides - no external components (resistors) are required ..
Have a look at the 74OL6000 series: https://www.fairchildsemi.com/ds/74/74OL6000.pdf ..

Regards,
IanP

### DrWhoF

Points: 2

#### DrWhoF

Re: 700m telemetry

Yeah, I can get PICAXE-18X.
How can I control the flow of data with PICAXE and isolated RS-485?
Can you suggest how to read rotary encoder and convert it to distance?

#### IanP

Re: 700m telemetry

You can control data flow using additional pin.
In PICAXE you can program any pin to receive data, any pin to transmit data, so you can program another pin to change its state just before you send data out and return to the previous state immediately after data transmission is done to alow data reception ..

Your second question is more complex. Maths is not the strongest point of PICAXE.
Also, to properly read a rotary encoder (unless this is not just a wheel with a couple of reed switches) you wuill need to read an input in a loop, or, much better use an interrupt ..
This can be a problem with PICAXE as the interrupts on its inputs have some limitations .. see Manual 2 on SETINT command ..

Regards,
IanP

### DrWhoF

Points: 2

#### DrWhoF

Re: 700m telemetry

My rotary encoder is standard 100ppr 2-wave sensor.
If you say interrupts "have some limitations" and "maths is not the strongest" do you think PICAXE can do this job? I don't want to add a coprocessor.

#### IanP

Re: 700m telemetry

The decision whether to use PICAXE or not depends on the number of pulses per second ..
If the encoder rotates slowly, say, below 10rpm (your encoder has 100ppr) - you will have ≈16.7 pulses per second, and I think PICAXE should be quick enough to count these pulse up or down, save the count in its memory and send it (the count, that is) out at 4800bps ..
I don't think it will be able to perform simple mathematical calculations as far as the distance is concerned. These calculations must be performed at the other end ..

If the ratation of your shaft encoder is well above this value (10rpm) you should consider different controller ..

Regards,
IanP

### DrWhoF

Points: 2

#### DrWhoF

Re: 700m telemetry

This rotary encoder will be coupled with shaft of a valve.

#### conkhicon

Re: 700m telemetry

DrWhoF said:
I need to design and build telemetry system to control a device 700m apart.
At both ends I need 4 digital inputs, 4 digital outputs, 1 analog input (0-5V) and 1 analog output (0-5V).
In addition I need to read rotary encoder with 2 signals shifted by 90°, convert it to distance and send through telemetry to the other end.
Any ideas are welcome.

What does telemetry mean?.

#### IanP

Re: 700m telemetry

Telemetry is a technology which allows the remote measurement and reporting of information of interest to the system designer or operator. The word is derived from Greek roots tele = remote, and metron = measure. Systems which need instructions and data sent to them in order to operate require the counterpart of telemetry, telecommand.
Telemetry typically refers to wireless communications (i.e. using a radiofrequency system to implement the data link) but can also refer to data transfer over other media, such as a telephone or computer network or via an optical link.

https://en.wikipedia.org/wiki/Telemetry

Regards,
IanP

DrWhoF said:
This rotary encoder will be coupled with shaft of a valve.

Valves are usually pretty slow ..
Could you confirm its RPM, or better, the maximum expected number of pulses per second ..

Regards,
IanP

### DrWhoF

Points: 2

#### IanP

Re: 700m telemetry

And one more thing: as you are talking about a valve, the number of turnes won't be indefinite ..
Could you confirm how many turns the shaft will be turning in one direction before doing the same amount of turns in the opposite direction?

Regards,
IanP

### DrWhoF

Points: 2

#### DrWhoF

Re: 700m telemetry

Yeah, you are right. The (valve) rotary encoder will have 36 turnes there and 36 turnes back and each turn will have 30 pulses. Maximum RPM will be 5.
I dont need to calculate distance. Number of pulses and direction is all I need.

#### IanP

Re: 700m telemetry

In this case, if you have access to PICAXE-18X, you can try the following code:
Code:
	setfreq m4				; Freq 4/8MHz & 4800/9600bps

symbol CounterL = 0		' memory location 0
symbol CounterH = 1		' memory location 1

'write CounterL, 0
'write CounterH, 0

setint %01000000,%01000000	‘ activate interrupt when pin6 goes high

loop:

pause 2000				‘ wait 2 seconds
goto loop				‘ loop back to start

interrupt:

if pin6 = 1 then interrupt	‘ loop here until the interrupt cleared

if pin7 = 0 then increase

let w1 = w1 - 1
goto exit

increase:

let w1 = w1 + 1			' w1 = b3(H) b2(L)

exit:

write CounterL, b2
write CounterH, b3

sertxd("<", #w1)			' send counter w1 via SerPort

setint %01000000,%01000000	‘ re-activate interrupt
return				‘ return from sub

This SUB counts pulses on IN6 and direction (count up or count down) on IN7.
You can try both frequencies: 4MHz (setfreq 4m) or 8MHz (setfreq 8m).

At this stage try to connect only one signal to IN6 (PICAXE-18 pin 15) and open any Windows termianl software (4800 .. ) or use Terminal option within PICAXE Programming Editor .. and check how fast you can count pulses ..
The result will be displayed in the following format: <1<2<3 ..<65535<0<1 .. and so on ..

Regards,
IanP

### DrWhoF

Points: 2

#### IanP

Re: 700m telemetry

If you don't have access to the real encoder you can simulate its action using another PICAXE. Here is an example of a short program that will generate 1000 pulses of, in this case, 10ms(pulse)+10ms(pause)=20ms
Code:
	wait 5				' wait 5s after power on ..

for w1 = 0 to 999

pulsout 2,1000 			' send a 10 ms pulse out of pin OUT 2
pause 10 				' pause 10 ms

next w1				' loop back to start

stop
You can run it and check if the oter PICAXE reads, saves and displays all 1000 pulses without missing anything ..

Also, keep in mind that nubers of pins used in programs are not related to the real microcontroller pins ..
For example:
In0 --> pin 17
In1 --> pin18
..
Out2 --> pin8
Out3 -->pin9
.. and so on ..
(check with PICAXE's manual in HELP)

Regards,
IanP

### DrWhoF

Points: 2

#### DrWhoF

Re: 700m telemetry

I have 2 PICAXE-18X and I programmed one with code which reads encoder (8MHz) and the other one with pulse generator.
I tried several pulses/pauses and 1000 pulses were counted/displayed correctly with pulses/pauses longer than 9ms+9ms=18ms.
That gives us the maximum frequency of more than 50Hz comparing with less than 10Hz required to count pulses from the valve rotary encoder. WOW !!!
Do you have any suggestion about the other end? How to display results and how to operate digital inputs/outputs?

#### IanP

Re: 700m telemetry

So the question whether this job can be done using PICAXE is settled down ..

As far as digital inputs are concerned you can hardwire microcontroller input pins to switches, analog input can be hardwired to a 0-5V 1-10kΩ potentiometer, and information form the other end analog input can be displayed on LCD display ..

Could you specify what are you going to control and what (and its format) are you going display ..

Regards,
IanP

### DrWhoF

Points: 2

#### IanP

Re: 700m telemetry

As an alternative to buttons, potentiometers, switches and LCD diplays you can consider more "contemporary" version of controlling machines: computer screen as display and mouse as the rest ..
Below is an example of a front panel of Hydraulic Press controller ..
This application was written in LabView and supplied to the client as self-extracting executable. Of course, it was much more complex application than just controlling 4 digital outputs and reading one analog channel, but the idea is the same - no extra hardware is required ..
Maybe you should consider this option ..

Regards,
IanP

### DrWhoF

Points: 2

#### DrWhoF

Re: 700m telemetry

I need to display Force (analog channel in), Turns of valve (rotary encoder) and Direction, set Torque in numbers from 0 to 2700N/m (analog channel out) in 10 increments and have two buttons: Forward and Reverse (Digital I/O).

Option with computer screen and mouse is very tempting. I don't have Labview and have no idea how to use it. Can you elaborate more on this option.

Status
Not open for further replies.