|
|
View previous topic :: View next topic |
Author |
Message |
ELCouz
Joined: 18 Jul 2007 Posts: 427 Location: Montreal,Quebec
|
Long ADC distance... |
Posted: Sun Feb 26, 2017 2:15 pm |
|
|
Hi there it's been awhile ,
I have on hand this little capacitive soil sensor.
--->>>>https://www.dfrobot.com/wiki/index.php/Capacitive_Soil_Moisture_Sensor_SKU:SEN0193
Unfortunately it doesn't have a digital output only analog.
What would be the best way to send the analog signal for 10 meter?
I guess that it would pick-up EMI badly by the time it reach the PIC ADC even with proper shielded wires.
I will have around 10 of these sensors (waterproofed) in a outdoor garden.
I though of having a ATtiny85 attached to it and send the ADC data through a 1-wire (TX only) software serial.
Then on the PIC have 10 pins attached to each their own software serial.
I really want to have them on different bus case something goes wrong (ex: line being pull-down) plus wont have to deal with packet collisions.
Any ideas? _________________ Regards,
Laurent
-----------
Here's my first visual theme for the CCS C Compiler. Enjoy! |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Sun Feb 26, 2017 3:33 pm |
|
|
1st... 10 Meters( 33') isn't that bad for analog to survive though I 'd use a 'rail to rail' op amp as a buffer. You could use CAT5 cable, 1 pair for power, 1 pair for signal and gnd. CAT5 is 'twisted pair' so even without the buffer it'd probably work fine.
You should do a real 'field test' to see what it's like, you might be surprised.
If it seems OK, consider doing an Olympic Average( it's been discussed here...), never rust just one reading.
2nd If it's too noisy (unreliable), I'd use a 12F PIC(8 pin) device for the remote and 'program' an ID into each device. Now you 'should' use and RS485 driver for PIC to PIC for best noise immunity but it adds a cost. So the trade off is spend more money but get reliable communications.
RS485 isn't the only option, several exist and I have remote device that are hard wired (solid copper) going 10+ miles (yes, MILES).
Whatever method you use, develop a method to confirm that the remote IS there and functional.
As for a 'scan rate' doing all ten in a second is more than enough time.
Jay |
|
|
NAR
Joined: 01 Dec 2016 Posts: 17 Location: IL, USA
|
|
Posted: Sun Feb 26, 2017 3:53 pm |
|
|
Depending on cost limit of each sensor device and if expanding the device later is an option; I would use CANBUS.
- Fewer wires, (only 4) The same 4 visit all devices (two CAN and two power). Its really one wire with 4 core or 8 core (RJ45)
- Add more functions to each device in the future, (you know you already have a PIC in there) so water sensor, snow, motor control, lights control...
- Add more devices just by extending the cable from last device to a new device (sensor), no need to change code in any unit to add more sensors. (handle 255 addresses/IDs from the start)
- Main controller overhead is only looking at a single CAN interrupt for incoming messages. So it can do a lot more
- Add more 'listeners' easily. Just by plugging into the bus (More display screens, iPad, iWatch...etc.)
- Bus handles collisions and out of sync devices.
- Long distance. I've used it for about 500 meters. But was sending 24v power for voltage drop.
- May even find a stand-alone CAN controller chip that accept single analog input to transmit over the bus. Assuming very limited budget/space for the sensors.
Now, all the above maybe overkill... but that's what I would do |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Sun Feb 26, 2017 6:01 pm |
|
|
CAN, like most protocols is extremely 'top heavy' and not needed for a project like this. Specialized hardware($$), huge overhead(RAM,ROM, etc). Also what are the power requirements for a CAN based remote, remember this is a direct wire system so 4 maybe 8 small conductors could be available. The bottomline..cost...is also a major factor, while time never seems to count, as it's a home project.
It's all in the 'details'...like what happens when the CAN bus is shorted or opened? Can you detect and disable the bad node, letting the rest of the system operate? The system I used for 30 years can operate with just one wire(no NOT the 'one wire bus' by DALLIS Semi), it'll fail miserably with a short.
Heck, CCS supplies code and example of their 'one wire' PIC to PIC communications method,at slow speeds it might actually work fine for 10M.
For a small network ( 256 devices) over a short range ( <500') using a common power supply I'm thinking RS485 might be the best solution, though you need to test in the real world !
Jay |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1907
|
|
Posted: Sun Feb 26, 2017 7:31 pm |
|
|
Try it and see what you get. Compare your remote reading to that you measure at the sensor with a DMM (use a short cable and battery or lab power supply so that you know for sure that you're eliminating any external EMI/whatever).
Personally I'd use a rail-to-rail voltage follower 1st in your signal path in the master board, and have that drive an RC LPF with ~ 10Hz cutoff frequency. The output of that would go to your processor's A/D input.
Unless you have overhead power lines directly adjacent to a run, I don't think you're going to pick up much noise in 10m. If you do have noise, then you can add a resistor to ground on each signal input to your master board. Noise is worse if you have lines with high impedance to ground. Add a resistor low enough that it doesn't affect the output of your sensor. |
|
|
ELCouz
Joined: 18 Jul 2007 Posts: 427 Location: Montreal,Quebec
|
|
Posted: Sun Feb 26, 2017 7:48 pm |
|
|
Thanks guys for all your ideas!
CANBUS is overkill so is RS485 IMO. I will test the reading at 10M and compare.
Olympic Average is really something I was looking for! Thanks!
The dsPIC30F6014A I planned to use has 16 ch. ADC @ 12-bit. If I can receive the signal without much EMI (garden water pump near-by) that would be great. I will try the passive options listed above.
I have in bulk outdoor XLR cables (2 wire + shield) which would more than perfect for these sensors!
Thanks again! _________________ Regards,
Laurent
-----------
Here's my first visual theme for the CCS C Compiler. Enjoy! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Mon Feb 27, 2017 1:30 am |
|
|
Historical suggestion.
Convert it to a current.
This is the basis of the 4-20mA instrumentation interface. Instead of sending voltages you send a variable current. This can then be converted back to a voltage at the receiving end, by just putting through a resistor. Lovely thing is you can then make the 'loop' isolated at one end (usually the transmitter - or even both, but this in unnecessarily complex), getting rid of potential ground problems between the devices.
The other nice thing is that interference, far less affects wires carrying a noticeable current, and if you use a twisted pair, tends to affect both lines equally. |
|
|
gjs_rsdi
Joined: 06 Feb 2006 Posts: 468 Location: Bali
|
|
Posted: Mon Feb 27, 2017 4:47 am |
|
|
Depends on the resolution you need.
I used in the far past 30 meter analog lines with shielded wires, one side shield connected to ground, 8 bit resolution will 8 reading averaging and worked fine.
Best wishes
Joe |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Mon Feb 27, 2017 7:42 am |
|
|
Come to think of it, I still have 3 sensors in the attic and one on the garage for some 'solar experiments' from a few years ago. LM34 with R2R opamp/2SLPF and 4C 'belltell' wire. Never had any noise problems.
One thing to rememeber is you do NOT need fast communications. Temp, humidity, door switches, etc. are all low speed reactions so you don't need microsecond updates !
My remote energy system (direct wire(Bell tell stuff), 10-15 miles) runs at 24 Baud..yes, twenty four bits per second.. NO problems.
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Mon Feb 27, 2017 8:26 am |
|
|
Honestly, make your own sensor....
Look at its circuit. It's only a CMOS 555 oscillator, with its frequency being changed by the capacitance. The output pulse is integrated into a capacitor to generate the output voltage. You could do a far more accurate/stable version, giving a serial output, using one of the PIC's designed for capacitance measurement (like the 12LF1552).... |
|
|
gareth_trinity
Joined: 27 Feb 2017 Posts: 6
|
|
Posted: Tue Feb 28, 2017 5:32 am |
|
|
The output of the sensor is 0-3v.
The adc contains a small capacitor in the pic which needs to charge up to the voltage being supplied by the sensor.
So all you need to do is have a sample time that gives plenty of time for the adc sample capacitor to charge up before beginning to sample.
The only things you need to factor in is the source impedance of the sensor - if it exceeds the adc recommended impedance you need to buffer the signal before putting it into the pic.
You may also need to factor in induced noise on the long line, shielded cable may help - use shielded cat5 to carry power and the return signal.
Alternatively use a long s/w filtering buffer to average out the signal.
Suggest take samples in 3's, get the median, add to a rolling average buffer of n samples. repeat..
You are probably thinking of resistance based temperature sensors where a very long line can add to the resistance of the measurement and cause an offset to the reading (ohms of wire + ohms of sensor).
But this is not the case here with this soil sensor. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Tue Feb 28, 2017 6:20 am |
|
|
I'll play 'Devil's Advocate' to MR. T.
In the good old days, yes, I'd make my own sensor unit(BTDT) but these days 'someone' probably already has and is selling an 'off the shelf' solution for a few bucks. The sensor posted is less than $10, so 10 would be $100.
If you consider R&D time in cold hard cash, there is no way anyone could engineer an equal product and be $$ ahead. even at $10/hr that's only 10 hours,one 'short' day for me. Yes, you could design/build a better sensor but by the time you do, honestly, it'll be NEXT summer,if you're lucky. A LOT goes into a product.Deciding on the parts, POC R&D,PCB design, Real World testing , redesign and more testing. 'Fun' with analog,digital and code....Reality is it's NOT a simple task. Now you WILL get a great learning experience and become intimate with PIC and parts, but you'll spend a LOT of time, more than you think. Just choosing the 'right' PIC could easily cost you a day or two.
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Tue Feb 28, 2017 8:31 am |
|
|
If this looked to be a 'good' sensor, I'd agree.
However if you look at the circuit, it is not likely to be a reliable way of doing the measurement.
Now if this is a 'homebrew' project, then the time involved in designing your own, can relatively easily be justified, and you then know how it works (and can send the data in a more reliable way).
If instead it is a commercial product, then the time/cost, is probably even more justified.... |
|
|
ELCouz
Joined: 18 Jul 2007 Posts: 427 Location: Montreal,Quebec
|
|
Posted: Thu Mar 02, 2017 9:11 pm |
|
|
I really like all the ideas but like temtronic said I purchased the already made sensors to offset the R&D stuff.
I just have to concentrate on the reading part. I wish I could have done electrical engineering like you guys have but for hobby interest this is way overkill
Heck, even a 0-5v Vref on a 3v output sensor is enough precision for a simple dry to wet (I'm looking at max 10 level of readings,very coarse).
Also, ADC readings will be slow once per minute at best since soil moisture content is something that react slowly over the course of hours.
Might be a stupid question, how can I measure the sensor impedance?
Thanks again guys! _________________ Regards,
Laurent
-----------
Here's my first visual theme for the CCS C Compiler. Enjoy! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Fri Mar 03, 2017 1:59 am |
|
|
True impedance, can get complex... (hopefully some people will understand this).
Simply feed the device into a DVM. Measure the voltage. Then without changing anything, put a 10KR resistor across the DVM. What does the voltage change to?.
Zo = (Rl ( V-Vl ))/ Vl
Where V is the voltage measured without the load, Vl is the voltage measured with the load present, and Rl is the load (10KR).
Given the device is not waterproof on it's upper part you are going to have to encapsulate/pot this here. Honestly add a rail-rail op-amp, to give significantly more drive, then with a reasonable cable, for the low accuracy you want, it should be fine. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|