I’ve finally gotten around to trialling my Gravity: Throw-in Type Liquid Level Transmitter with an UNO Arduino. Very easy to set up and get running.
Problem is that the levels being sent are all over the place. I see the depth vary by over 1,000mm!!! The DFRobot FAQ tells me that it’s the noisy power supply to the sensor. I’ve tried 3 different power supplies that I had, all with similar results. Even an old laptop power supply.
I even tried a 12v battery and saw an improvement, about 90% of the readings were ok. The spike every 10 seconds or so was only 20mm of depth. But then the battery needs charging.
Google tells me that I need a linear regulated power supply, and these aren’t easy to find. They’re also expensive and some articles say that they can also be noisy
Can you pls recommend one that will work. The voltage range on the sensor is 12-36 vdc and the current draw is small being a 4-20mA device.
Somewhere I did read that the analogue current to voltage converter board is also noisy, so open to suggestions here too if that will improve the reliability of the data.
The general recommendation would be to use a low noise power supply, however one thing you can try is a decoupling capacitor to reduce noise. Sparkfun has a great little guide/explanation on this that you can find via this link.
Blayden, thanks. Where would you recommend for a low noise power supply? Lots on Ebay but who really knows how good they are. Some audio hifi shops have them for $100!!
The decoupling capacitor sounds interesting. I assume the ‘IC’ here for me is the analogue current to voltage converter board? Would I connect these on the current side (that is where the noisy power supply is) or the voltage side?
If you can find a supply a few volts north of 12V I might suggest a 7812 linear voltage regulator or any of the 78XX series. They are pretty good at removing nasties, cheap ($1.85 at Jaycar) and if not dropping too much voltage good for nearly 1A. Data sheets have lots of info regarding recommended bypass caps etc.
Bob, thanks. So I’d mount this voltage regulator after my existing power supply and before the sensor?
Sorry for the noob question, I’m a mechanical engineer and dabble in this sort of stuff!
Yes. But the regulator needs a bit of head room. The input voltage has to be I think from memory about 2V above the output, so for a 7812 the input should be at least 14V. Or if you had a transformer you could knock up your own linear power supply using one of these regulators. Other common voltages are 7815 and 7824.
Bob, thx again. I’ve got a 19V laptop power supply kicking around that I can use, plus a prototype breadboard to test this out.
I’ll get to Jaycar in the next few days.
At 19V that is a 7V drop across the regulator. It has a max input voltage of 35V but if you are drawing anything close to 1A too may need a heat sink. If only a few mA no heat sink should be OK. Min voltage for 12V out is quoted at 14.6V.
A handy regulator to have around is LM317. This one is adjustable and with the addition of 2 resistors you can have any output within its range.
Robert, thanks again. Heatsink already on the shopping list
I’ll start with this as a proof of concept.
Copy of a bit from National Semiconductor Data sheet for LM7812.
It is not necessary to bypass the out-
put, although this does improve transient response. Input by- passing is needed only if the regulator is located far from the filter capacitor of the power supply.
For output voltage other than 5V, 12V and 15V the LM117 series provides an output voltage range from 1.2V to 57V.
Robert, many thanks again.
While at Jaycar I bought a kit, a KC5501 that has all the components and PCB for what looks like a regulated power supply. It has a capacitor on the input. It’ll make the job easier for me.
When you say ‘far from the power supply’, are we talking 6 inches or 6 feet?
Why??? You have still got to supply it with AC from a transformer of some description. It is not exactly a plug and play device. Seems strange when you say you already have a unused laptop supply.
If you want to use this you now have to choose a transformer. The Jaycar catalog does not give the current capabilities but as it uses 78XX or 79XX (79 series are negative regulators) I would assume about 1A. I note the recommended AC plug pack is rated for 1.5A. Now when it comes to rectified DC you can’t obtain the full rated transformer current. This depends on the type of rectification used. A bridge rectifier being the most efficient. I forget the actual numbers now but a bridge rectifier will allow about 60 something % of the transformer current as DC so about 1A is max. In contrast a half wave rectifier is a bit below 30% I think and full wave is somewhere in between. So you see there is a bit more to planning this thing than it seems when you say it quick.
As it has got to be a transformer AC input I don’t think so.
More like 6 inches. It is to get rid of the effect of the inductance of the wiring between the power supply and regulator. And yes, a straight piece of wire has inductance which is measurable if the wire is long and thin enough.
Matt, why are you complicating things. You want to get a clean supply to get proper readings from your sensor and I think a linear regulator (LM7812) will help. Why don’t you try this with your 19V supply and see if it works. If it does then introduce this item but don’t go and introduce several bits as you will never know what fixed your problem.
This Jaycar device is a linear power supply when coupled with the recommended transformer plug pack. It looks like it can be configured several ways like + & - split supply or a single supply. and at the end of the day will probably do your job nicely. For your application you only need a single supply but I would need to see the schematic or instructions to have any input into that side of things.
Hi Rob, thanks for your concern.
The kit also takes DC input. I saw the kit as a convenient way to hold all the components I need as I don’t have much around to help with this.
Yes. If the input goes straight to the bridge rectifier (It seems to have 4 diodes so I imagine it does) a Dc input would work and have the advantage of not caring which way around the DC is connected.
Are the regulators fitted and if so what are they. The device is listed as + & - 15V so I assume they are LM7815 and LM7915. If your sensor is OK with 15V you could leave them there or if you wish you can use the LM7812 for 12V. Without seeing the schematic or instructions I could not be sure but if you are using this as a single supply the 7915 is not required.
If you intend to use your 19V laptop supply then the output from the bridge and thus input to the regulator will be 19V minus 2 diode voltage drops (1.2V) which is 17.8V making the drop across a 12V regulator 5.8V which will result in less power loss (heat) across the regulator.
Jaycar recommend a transformer plug pack of 15VAC but then say the supply can be + & - 15VDC or a single 15V supply and I don’t see just how this is done. I think I would like to see the schematic or the operating instructions before I make further suggestions
Is there any chance you can scan this info and message me. My nearest Jaycar is some 30 odd kM away and I have no immediate plans on going anywhere near them for some time. If they were clos I could go and ask them for a copy but that’s not very practical.
Just got to read the opening page of the original Silicon Chip article. It seems that you actually can have several different (4 I think) configurations and you build it to suit the one you want. In your case build it for single supply and fit whichever regulator you want (12 or 15V). Single winding transformer input and connect your laptop supply. I don’t have access to the full article but you should have it as if Jaycar stick to what they used to do the docs will be a copy of the original article in March 2011 issue.
And you are right. This could be the most convenient way for you to go. Basically the same as I suggested but you now have a board to mount everything.
There are a few factors you need to consider here.
The supply to the sensor needs to be separate from the UNO supply.
The sensor is a 4-20mA device, therefore it produces a current in that range that is proportional to the depth.
This current is then converted to a voltage by the Gravity convertor, which the UNO is reading via an Analogue input.
The sensor NEEDS 30 minutes to stabilize (see the usage notes).
If you have a sensitive multimeter (i.e. has a current range of either 20mA or 100mA and at least 4 digits), you should be able to put that in series with the sensor and read the current to see if that is actually fluctuating. Some mulitmeters and industrial testers have specific 4-20 ranges.
For the power supply, you have used a 12V battery, with some success. Since it is only supplying a maximum of 20mA is should last quite a while. If not try a larger battery, although I have successfully used two 9V batteries in series to test 4-20mA devices, but not when they need a 30minute warm-up.
The Gravity convertor should be quite stable, but may benefit from a capacitor across the supply.
The UNO only has 10bit ADC resolution, and expect the LSB to fluctuate.
Finally, I don’t see any need to use the Jaycar kit, any reasonable 12V plugpack should be OK to supply the sensor, or even a laptop supply as someone else suggested.
I believe that by doing this Matt more or less proved his supply was most of his problem.
I think the 4-20mA loop seems to be working OK. For this application where the current apparently changes with tank level a DMM would be fine for current measurement. But this method can be used (and was at one time) to transmit data where a DMM would be pretty useless.
I suggested that a linear regulator is pretty good at cleaning up a supply voltage as long as it has enough headroom. Matt suggested an 18V laptop supply which should be pretty good used with an LM7812.
The Jaycar kit is a convenient way to mount all the bits required to use the regulator. That is his reason for purchasing this. Has to be assembled for single supply output.
One of the problems with using a switching supply or regulator is the inductance of long supply leads. This can be negated by using an electrolytic cap across the supply. But it must be located at the far end at the powered device end, as close to the device as possible. This is taken care of by the Jaycar kit having filter caps after the bridge rectifier. This will take care of that job. The LM7812 Data sheet suggests that an input supply lead length any greater than about 150mm should have an electrolytic cap at the regulator input.
Yes, I’m using a separate power supply for the sensor. The DFRobot Wiki has nothing about 30 mins to stabilise. Can you pls give me a link for the usage notes you refer to. It was the DFRobot FAQ for this kit that took me down the noisy power supply route. Running on a battery confirmed it for me.
I’ll see if my Fluke multi-meter can measure the current. Good idea to try to pin down the source of the issue.
I tried a couple of DC power packs through the Jaycar kit with little success. The best success has been using an AC power pack through the Jaycar kit.
I’ve also added a Running Median digital filter to the Arduino program with some success. This has had weird effects on the Arduino program if the sample size is too large.
This is what I suggested using a linear regulator to “clean up” a power source. I really could not think of anything simpler.
If you cannot solder a couple of wires to the regulator you could make it up on a small terminal strip pretty easily.
The capacitor may not be needed. Laptop supplies generally have a ferrite filter on the DC wire, that’s what that black lump is. If needed the value is not super critical. Anywhere between 470µF to 1000µF should be OK. Have a look at 7812 Data sheet. Caps on the output normally are not required and are optional.
This is what basically what you should have finished up with if you built that Jaycar kit as a single output supply. I have not seen it so I can’t be sure and you haven’t sent me a scan of the schematic/instructions but you say you got better results having an AC input which suggests either you have done something wrong or the instructions are not what I am thinking. Maybe both.
I think you should rationalise your power supply problem first. The idea above is the simplest thing I can think of but if you don’t feel like trying it I will have to retire. I am a firm believer in not complicating a problem and like to try simple approaches first.
That is what we are trying to do.
It certainly will. BUT there are pitfalls. On the mA and lower current ranges the internal resistance of the meter can cause malfunction of the circuit under test due to voltage drop across the measuring meter. This may not be a concern with the 4 - 20mA loop as the supply loop should be a constant current set up and should take care of this extra resistance as long as the supply to the system has enough voltage head room. That is the advantage of this system as subject to some limits it is pretty immune to external line resistance variations. A better way if it can be done is use the 10A range with its very low internal resistance. A quality meter such as a Fluke should have mA resolution on this range.
the 30 minutes is on the Core product page.Gravity: Throw-in Type Liquid Level Transmitter | DFRobot KIT0139 | Core Electronics Australia
Look under the ‘Usage Notes’ section.
4-20mA is a very common Industrial protocol for control of numerous processes and would not be susceptible to ‘noise’.
As you say using a battery was much more successful, stick with that and wait the 30 minutes for stabilization. There should not be much need for filtering, but try reducing the sample rate to every few seconds and average over 10 or 20 readings. Have the adruino print out both the ‘raw’ and filtered result.
Also check the wiring. If you use jumper wires they can be of variable quality and make poor contact. If you can solder that would be better.
Oh and when you say the supply is separate, do not connect the Grounds together, because the current loop is just that, a simple loop V+ to sensor+, sensor- to amplifier+, amplifier- to V-.
Dave, thanks again. I went straight to the product wiki page, didn’t even see the warm up notes
Thanks for the hints re wiring. Yes, supply grounds are not common either.