⚠️ This forum has been restored as a read-only archive so the knowledge shared by the community over many years remains available. New registrations and posting are disabled.

All times are UTC + 8 hours




Post new topic Reply to topic  [ 155 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 11  Next
Author Message
 Post subject: Re: Arduino DataLogger
PostPosted: Nov 25th, '11, 19:51 
A posting God
A posting God
User avatar

Joined: Oct 16th, '11, 06:12
Posts: 2019
Gender: Male
Are you human?: 0110010110
Location: Brisbane, qld
DuiNui wrote:
Forgot to say...
On the subject of IR, it's a bloody nightmare doing anything in daylight or with fluids around.
I have done a lot of work with IR sensors, one thing I noticed while developing an IR Lap Timer was that plant life reflects huge amounts of random IR noise.
All in all making it pretty much a no go in a GB, daylight, water and plants...


Just wondering if it would help much to use one of those dual channel PIR sensors. The ones used for motion sensing on security systems. The sensors have 2 "beams" and only output the difference between them. Basically this means that any IR generated by the sun coming up or other ambient sources are cancelled out because it only outputs the difference between the 2 beams. However if you walk past the sensor or something goes past in the right direction (say left to right, right to left) then you will get an output from the sensor. Bit more expensive but much more reliable for detecting moving objects.


Top
 Profile  
Reply with quote  
    Advertisement
 
 Post subject: Re: Arduino DataLogger
PostPosted: Nov 25th, '11, 19:58 
A posting God
A posting God
User avatar

Joined: Oct 16th, '11, 06:12
Posts: 2019
Gender: Male
Are you human?: 0110010110
Location: Brisbane, qld
Erbey wrote:
Well, thats a small project for my mums place. chickens kept getting eaten because people kept forgetting to close the door at night.
So simple solution with another photoresistor pressure switch and an XOR digital logic gate that can be found here...
http://australia.rs-online.com/web/p/gates/0442993/

XOR truth table looks like this...

light open/close | Out
0 0 | 0
1 0 | 1
0 1 | 1
1 1 | 0

So using another voltage divider circuit with a photoresistor and a calculated resistor to match.

If its dark, V over photoresistor will be high leaving voltage over the other resistor low (so = 0)
if its dark door will be closed opening the switch so no current and also = 0
both = 0 so no output

as sun comes up and resistance over photoresistor decreases enough, and that voltage then goes over that goes down, while the voltage over the constant resistor goes up, bringing it up to HIGH or a 1.
but the door is still closed and switch open so =0
Now the output will be 1/HIGH/5V this will go to a transistor controlling a 12V actuator that will open the door until the switch closes giving a HIGH reading. where it sits until the sun does down repeating the cycle.

I haven't chosen the resistor yet because i dont know if it will be on a separate circuit to the 12v battery or not. But i'm sure it will be now, so ill calculate what resistance ill need and post my results here.

This should hopefully work, Otherwise i have just invested in 5 attiny85 microcontrollers that should do the job is it doesn't work.


Hi Erby,
You might want to incorporate some kind of hysteresis into that system. If you use an analogue signal to drive logic its very easy to get oscillations when the signal hovers around the threshold voltage. What I mean is that noise etc on the analogue signal can cause the logic to turn on and off rapidly. Incorporating a Schmitt trigger or some sort of comparator into the design would result in much better reliability.


Top
 Profile  
Reply with quote  
 Post subject: Re: Arduino DataLogger
PostPosted: Nov 25th, '11, 20:34 
Newbie
Newbie

Joined: Sep 18th, '10, 19:15
Posts: 28
Gender: Male
Are you human?: yes
Location: Perth, WA
SuperVeg wrote:
Hi Erby,
You might want to incorporate some kind of hysteresis into that system. If you use an analogue signal to drive logic its very easy to get oscillations when the signal hovers around the threshold voltage. What I mean is that noise etc on the analogue signal can cause the logic to turn on and off rapidly. Incorporating a Schmitt trigger or some sort of comparator into the design would result in much better reliability.


Hi, SuperVeg,
thanks for having a look.
This actually crossed my mind (the oscillation part anyway). But I haven't ever looked into what a Schmitt trigger was, had just heard the name.
I suppose I just hoped the oscillation wouldn't be too bad, just shake the door for a bit till it made its mind up lol. This is what happens when you read too many books rather than building the actual circuits.
But i had also bought some attiny85's incase the XOR gate didn't work out. In fact I originally planned to use the attiny's until i realized it was probably overkill.

Oh well, I picked up my microelectronics book and I'll read up on schmitt triggers a bit more. Thanks for the advice!


Top
 Profile  
Reply with quote  
 Post subject: Re: Arduino DataLogger
PostPosted: Nov 25th, '11, 22:31 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
+1 to everything ...

WHAT ON EARTH ARE YOU PEOPLE TALKING ABOUT???

Man, I wish I paid at least a little attention in school :)

It's like you guys have just decided English isn't complicated enough :)

ok ok ok concentrate and re-read everything a few times... you can do this bullwinkle. It's what you do...


Top
 Profile  
Reply with quote  
 Post subject: Re: Arduino DataLogger
PostPosted: Nov 26th, '11, 00:57 
Almost divorced
Almost divorced
User avatar

Joined: Nov 11th, '09, 03:13
Posts: 1004
Gender: Male
Are you human?: The top half is
Location: Chiang Mai, NW Thailand.
SuperVeg wrote:
Good idea, switching the power one only when sampling would help, even better to do say 4-5 samples right after each other (switching off the power each time and take an average) Yes the high impedance of the water will be an issue. I would use as high a voltage as possible, say 12v at least (switched by a transistor). The higher the voltage the more noise immunity you will have. Then use a voltage divider to go into the ADC. Also important to add some noise filtering as close as possible to the ADC input.
Use a basic RC low pass filter, which is just a cap between the ADC input and ground, and a series resistor right before the cap. Should check values but something like a 100n cap and 50-100ohm resistor should be ok, just make sure its not too slow.


Thanks for your reply.
The impedance of the water is not the problem, it is actually only about 90k ohms at 2cm, it's the impedance of the input pin that causes the noise vulnerability, you have a very high impedance input with a 10 metre antenna on it ;)
Also you want to keep the voltage as low as possible to reduce electrolysis of the sensor pins.
In my test system, copper pins turned the water in the glass blue on an over night test so I changed to gold pins, the amounts of metal introduced into the system may be negligible, but I didn't want to risk it.
The supply voltage to the sensor was as low as possible, for as short a time as possible.
Also the input pin was digital, not analog. I really don't think this application warrants using the ADC, digital input _should_ be fine.

What I had planned to do was put a transistor at the sensor end of the wire. this would mean running 3 wires to each sensor rather than 2, but would eliminate noise induced through the cabling to the input.


Top
 Profile  
Reply with quote  
 Post subject: Re: Arduino DataLogger
PostPosted: Nov 26th, '11, 03:59 
Almost divorced
Almost divorced
User avatar

Joined: Nov 11th, '09, 03:13
Posts: 1004
Gender: Male
Are you human?: The top half is
Location: Chiang Mai, NW Thailand.
SuperVeg wrote:
Just wondering if it would help much to use one of those dual channel PIR sensors. The ones used for motion sensing on security systems. The sensors have 2 "beams" and only output the difference between them. Basically this means that any IR generated by the sun coming up or other ambient sources are cancelled out because it only outputs the difference between the 2 beams. However if you walk past the sensor or something goes past in the right direction (say left to right, right to left) then you will get an output from the sensor. Bit more expensive but much more reliable for detecting moving objects.


AFAIK, PIR's work by detecting IR emitted by a warm body, the "P" meaning passive.
So there are no beams as such, just 2 differential detectors.
I may be wrong, perhaps security devices have moved on since I was playing with IR.
In general I found it to be very hard to develop and debug (hardware and software)
It might be possible to mount an emitter and detector on each side of the stand pipe guard and have a floating piece of poly material break the beam, but I'm willing to speculate that as the rising water approaches the detector IR would be bounced around inside the stand pipe guard.
I'm not very good with mechanical things, I guess you could make something where the emitter was very close to the detector and have something floating in the water to break that beam.
Mechanical stuff always breaks though (well stuff that I make anyway) :D


Top
 Profile  
Reply with quote  
 Post subject: Re: Arduino DataLogger
PostPosted: Nov 26th, '11, 21:17 
A posting God
A posting God
User avatar

Joined: Oct 16th, '11, 06:12
Posts: 2019
Gender: Male
Are you human?: 0110010110
Location: Brisbane, qld
Erbey wrote:
Hi, SuperVeg,
thanks for having a look.
This actually crossed my mind (the oscillation part anyway). But I haven't ever looked into what a Schmitt trigger was, had just heard the name.


The biggest issue you have here is the slowly varying analogue signal which then controls a transistor.
A Schmitt trigger just provides a "dead band" between its input and the output.
Lets say your signal from the light sensor went from 0v to 5v. Also lets say the transistor will turn on at 2v (MOSFET). As the sun comes up the voltage on the gate of the transistor will slowly approach 2v and then it will turn on, opening the gate. As the gate is opening the voltage of the circuit might droop a little (depending on the design) and then cause the transistor to turn off. When it turns off the voltage will pick up again turning on the transistor. This could cause the gate to shudder as it closes or stop and start or open then close again, depending on how it is all connected up.
If you use a schmitt trigger between the photoresistor and the transistor, when the voltage droops a little the transistor will not turn off because the voltage has to droop by a certain amount before the output of the schmitt trigger will go low.
Not sure on the number but for example in the morning as the sun comes up the voltage will slowly increase to say 4v then the schmitt trigger turns on and the gate opens. The voltage from the photoresistor then has to drop to less than 1v for the output to go low, turning the transistor off.
So the voltage can go up and down between 1v and 4v and nothing changes
This will help prevent oscillation and erratic behaviour due to voltage droops and noise.

Oh yeah Very important, the other thing is that transistors are not just ON or OFF, they also operate between on and off. What I mean is if it is half way on then the transistor is acting as a resistor and will get very hot !! A transistor that you want to use as a switch should never be operated like this (in its linear region) otherwise you will let the smoke out (electronic parts all have a tiny little can of smoke in them, and if you let it out they stop working :laughing3: )
So the big advantage to the schmitt trigger is that it should switch the transistor on and off properly. If you use a BJT you might need to make sure the threshold voltages will all match up



You should also add a low pass filter to the input of the transistor to help with the higher frequency noise.
There are a few little things you can do at design stage to help eliminate these potential problems.
Oh and the second one is always better :)
Quote:
I suppose I just hoped the oscillation wouldn't be too bad, just shake the door for a bit till it made its mind up lol. This is what happens when you read too many books rather than building the actual circuits.
But i had also bought some attiny85's incase the XOR gate didn't work out. In fact I originally planned to use the attiny's until i realized it was probably overkill.

You can also do this sort of filtering in the software of the attinys that you have but its always better to start with a decent signal first :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Arduino DataLogger
PostPosted: Nov 26th, '11, 21:23 
A posting God
A posting God
User avatar

Joined: Oct 16th, '11, 06:12
Posts: 2019
Gender: Male
Are you human?: 0110010110
Location: Brisbane, qld
DuiNui wrote:
Thanks for your reply.
The impedance of the water is not the problem, it is actually only about 90k ohms at 2cm, it's the impedance of the input pin that causes the noise vulnerability, you have a very high impedance input with a 10 metre antenna on it ;)

You could just get really aggressive with the low pass filter, slow the signal right down...maybe
Quote:
Also you want to keep the voltage as low as possible to reduce electrolysis of the sensor pins.
In my test system, copper pins turned the water in the glass blue on an over night test so I changed to gold pins, the amounts of metal introduced into the system may be negligible, but I didn't want to risk it.

Ahh of course, however if you only spent a couple of milliseconds checking it each time, it would be negligible.
Quote:
The supply voltage to the sensor was as low as possible, for as short a time as possible.
Also the input pin was digital, not analog. I really don't think this application warrants using the ADC, digital input _should_ be fine.

What I had planned to do was put a transistor at the sensor end of the wire. this would mean running 3 wires to each sensor rather than 2, but would eliminate noise induced through the cabling to the input.

Yeah that could work


Top
 Profile  
Reply with quote  
 Post subject: Re: Arduino DataLogger
PostPosted: Nov 26th, '11, 21:39 
A posting God
A posting God
User avatar

Joined: Oct 16th, '11, 06:12
Posts: 2019
Gender: Male
Are you human?: 0110010110
Location: Brisbane, qld
DuiNui wrote:
AFAIK, PIR's work by detecting IR emitted by a warm body, the "P" meaning passive.
So there are no beams as such, just 2 differential detectors.
You are correct, I was just trying to "illustrate" the idea to any reader. I'm sure it would help to use one of these, as they eliminate the ambient radiation issues. Still may not work properly though...
Quote:
I may be wrong, perhaps security devices have moved on since I was playing with IR.
In general I found it to be very hard to develop and debug (hardware and software)
It might be possible to mount an emitter and detector on each side of the stand pipe guard and have a floating piece of poly material break the beam, but I'm willing to speculate that as the rising water approaches the detector IR would be bounced around inside the stand pipe guard.
I'm not very good with mechanical things, I guess you could make something where the emitter was very close to the detector and have something floating in the water to break that beam.
Mechanical stuff always breaks though (well stuff that I make anyway) :D

It is an interesting problem, complicated more so with the build up of bio slime and solids.
These make many simple mechanical solutions that are exposed to the water unreliable in the long term.
Another thought on the electrical detection side of things, I wonder what the most suitable metal is to use.. Maybe gold. many metals are toxic to fish/people. I don't think zinc, aluminium, copper, stainless are a good idea. Silver is anti microbial and thats definitely not a good idea in a biofilter. Not sure if gold is anti microbial also...
Pretty expensive if you use a couple of 1/4oz gold coins :D

What about a simple mechanical idea like having the water falling out of the pipe onto some sort of spring loaded "paddle" or lever that presses onto a switch. When the water stops the switch is opened/closed.. :think:


Top
 Profile  
Reply with quote  
 Post subject: Re: Arduino DataLogger
PostPosted: Nov 26th, '11, 22:14 
Almost divorced
Almost divorced
User avatar

Joined: Nov 11th, '09, 03:13
Posts: 1004
Gender: Male
Are you human?: The top half is
Location: Chiang Mai, NW Thailand.
SuperVeg wrote:
What about a simple mechanical idea like having the water falling out of the pipe onto some sort of spring loaded "paddle" or lever that presses onto a switch. When the water stops the switch is opened/closed.. :think:


One thing that's guaranteed with an electromechanical device - it WILL break, just a question of when.
With the humidity in Thailand, sooner rather than later is the answer.

I may revisit IR for this problem, but for now will play with resistive probes in the water, I've dusted off the dev kit, enthused again by this thread :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Arduino DataLogger
PostPosted: Nov 27th, '11, 06:30 
A posting God
A posting God
User avatar

Joined: Oct 16th, '11, 06:12
Posts: 2019
Gender: Male
Are you human?: 0110010110
Location: Brisbane, qld
I like the resistive probes too, makes it very simple.
Keep us updated on your progress and of course, we all love photos :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Arduino DataLogger
PostPosted: Nov 27th, '11, 13:45 
Seriously, this cant be healthy.
Seriously, this cant be healthy.
User avatar

Joined: Mar 26th, '10, 20:46
Posts: 5404
Location: South Australia
Gender: Male
Are you human?: Yep
Location: South Australia
I ran it through the invention engine and came up with a few ways around measuring water depth without all the noise from putting pins in the water.

costly but accurate
laser tape measure. Add a laser tape measure at the top of a pvc tube going into the water to create an island of calm.

reasonably priced but perhaps not so accurate
there is a sonic rangefinder that picaxe sells for its robots at around 20$ that would probably do the job. If you needed higher resolution than it could measure, you could probably rig up a float on a balance beam that was off centre so you got a lever effect to amplify the distance the other (non float) end moved to make it easier to get a height reading.

perhaps a bit flaky
a waterproof pressure pad with a float mounted in a PVC pipe so that it can only move up and down, in such a way as to make contact with the pressure pad.
you could even make the [url = http://120thingsin20years.blogspot.com/ ... build.html]DIY waterproof switch yourself[/url].

Safe mercury
add an extension rod and a float to your mercury switch so you can sit the switch outside the water

DIY
a float switch sans mercury could be made with a length of PVC conduit with two battery pack springs and a large stainless ball bearing. All water proofed with silicone.

DIY
get a length of PVC and stick it into the water. Create a float that almost fills the first length of PVC by getting a thinner PVC pipe and adding endcaps, or swirling some black paint around the inside of a soft drink bottle. Then put a LED on one side of the outside pipe and a light reading resister thinggy on the other side. It would make for a pretty good on off switch that would be waterproof, have basically no moving parts, and would last a few thousand years. It would also be easy to calibrate, and would always show the same light leakage when in the off position. You would need to counter sink the LED and light reader so the float didnt stick on them as it moved past them, but that would be easy enough to drill holes for them and mount them outside. You could waterproof all contacts, and none of the contacts need to be exposed to water. you could fine tune it by adding weight to (or in) the float, so build in a bit of error on the "slightly too floaty" side.

That last one would be what I would try from this selection.


Top
 Profile  
Reply with quote  
 Post subject: Re: Arduino DataLogger
PostPosted: Nov 27th, '11, 14:33 
Newbie
Newbie

Joined: Sep 18th, '10, 19:15
Posts: 28
Gender: Male
Are you human?: yes
Location: Perth, WA
SuperVeg wrote:
Erbey wrote:
Hi, SuperVeg,
thanks for having a look.
This actually crossed my mind (the oscillation part anyway). But I haven't ever looked into what a Schmitt trigger was, had just heard the name.


The biggest issue you have here is the slowly varying analogue signal which then controls a transistor.
A Schmitt trigger just provides a "dead band" between its input and the output.
Lets say your signal from the light sensor went from 0v to 5v. Also lets say the transistor will turn on at 2v (MOSFET). As the sun comes up the voltage on the gate of the transistor will slowly approach 2v and then it will turn on, opening the gate. As the gate is opening the voltage of the circuit might droop a little (depending on the design) and then cause the transistor to turn off. When it turns off the voltage will pick up again turning on the transistor. This could cause the gate to shudder as it closes or stop and start or open then close again, depending on how it is all connected up.
If you use a schmitt trigger between the photoresistor and the transistor, when the voltage droops a little the transistor will not turn off because the voltage has to droop by a certain amount before the output of the schmitt trigger will go low.
Not sure on the number but for example in the morning as the sun comes up the voltage will slowly increase to say 4v then the schmitt trigger turns on and the gate opens. The voltage from the photoresistor then has to drop to less than 1v for the output to go low, turning the transistor off.
So the voltage can go up and down between 1v and 4v and nothing changes
This will help prevent oscillation and erratic behaviour due to voltage droops and noise.

Oh yeah Very important, the other thing is that transistors are not just ON or OFF, they also operate between on and off. What I mean is if it is half way on then the transistor is acting as a resistor and will get very hot !! A transistor that you want to use as a switch should never be operated like this (in its linear region) otherwise you will let the smoke out (electronic parts all have a tiny little can of smoke in them, and if you let it out they stop working :laughing3: )
So the big advantage to the schmitt trigger is that it should switch the transistor on and off properly. If you use a BJT you might need to make sure the threshold voltages will all match up



You should also add a low pass filter to the input of the transistor to help with the higher frequency noise.
There are a few little things you can do at design stage to help eliminate these potential problems.
Oh and the second one is always better :)
Quote:
I suppose I just hoped the oscillation wouldn't be too bad, just shake the door for a bit till it made its mind up lol. This is what happens when you read too many books rather than building the actual circuits.
But i had also bought some attiny85's incase the XOR gate didn't work out. In fact I originally planned to use the attiny's until i realized it was probably overkill.

You can also do this sort of filtering in the software of the attinys that you have but its always better to start with a decent signal first :)



Thanks for the info SuperVeg, i had a quick read the other day. I think i will buy a few schmitt ttriggers, they look the would come in handy all the time.

I've just rigged up the same circuit i first proposed that looks like this (with and LED instead of actuator):
http://dl.dropbox.com/u/19981222/ChickenCoop/nosSchmittTriggerorFilter.png
connected to Digital 12 and Analog 0 of the arduino to see the outputs I'm getting. when covering with a piece if paper i seem to be getting pretty clear results. But paper and a torch if very different from the sun, so i have decided to link the two projects together and use the dataoggger to read and save the inputs I'm getting, so i can see how much oscillation I will get. unfortunately it will need to wait until i get the 2.1mm power jack and battery holder i ordered, hopefully tomorrow.

Here is another circuit i drew up that would include a schmitt trigger and simple low pass filter:
http://dl.dropbox.com/u/19981222/ChickenCoop/includingSchmittandFilter.png
Do you think this will do the job? Although the capacitor should probably be as close the schmitt trigger as possible rather than what it looks like in the diagram.
I can't test it out yet as i don't have any capacitors at the moment but plan on getting a heap (and more resistors) sometime next week.


Top
 Profile  
Reply with quote  
 Post subject: Re: Arduino DataLogger
PostPosted: Nov 27th, '11, 20:08 
A posting God
A posting God
User avatar

Joined: Oct 16th, '11, 06:12
Posts: 2019
Gender: Male
Are you human?: 0110010110
Location: Brisbane, qld
No worries,
Do what you can with the advice you get, then build and test it. Its when you have issues and have to fix them you learn the most :)
In the 2nd pic I think your LPF is the wrong way round, you need the resistor on the "noise" side of the cap, and the cap as physically possible to the schmitt trigger.

Apart from that it looks like it should work. Keep me posted :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Arduino DataLogger
PostPosted: Nov 29th, '11, 18:19 
Newbie
Newbie

Joined: Sep 18th, '10, 19:15
Posts: 28
Gender: Male
Are you human?: yes
Location: Perth, WA
Got the LCD screen today so I will post some code on how to use that soon. But i started work monday and have been to the doctor with a busted leg and I'm just buggered so don't know how long Ill take.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 155 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 11  Next

All times are UTC + 8 hours


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 post attachments in this forum

Search for:
Jump to:  
cron

Powered by phpBB® Forum Software © phpBB Group
Portal by phpBB3 Portal © phpBB Türkiye
[ Time : 0.072s | 14 Queries | GZIP : Off ]