Overunity.com Archives is Temporarily on Read Mode Only!



Free Energy will change the World - Free Energy will stop Climate Change - Free Energy will give us hope
and we will not surrender until free energy will be enabled all over the world, to power planes, cars, ships and trains.
Free energy will help the poor to become independent of needing expensive fuels.
So all in all Free energy will bring far more peace to the world than any other invention has already brought to the world.
Those beautiful words were written by Stefan Hartmann/Owner/Admin at overunity.com
Unfortunately now, Stefan Hartmann is very ill and He needs our help
Stefan wanted that I have all these massive data to get it back online
even being as ill as Stefan is, he transferred all databases and folders
that without his help, this Forum Archives would have never been published here
so, please, as the Webmaster and Creator of these Archives, I am asking that you help him
by making a donation on the Paypal Button above.
You can visit us or register at my main site at:
Overunity Machines Forum



Water Level Indicator...For HHO project.

Started by HeuristicObfuscation, December 29, 2013, 02:18:01 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TinselKoala

Quote from: HeuristicObfuscation on December 29, 2013, 06:07:48 PM
Thanks for the observation.

Ive been meaning to get into the arduino. Just been delaying due to time investment in the programing side.

Im more  hardware inclined but i due realize the benefits of bieng able to control outputs with the stroke of a key.

Any recomendations on best way to get started?

Sure: get yourself an Arduino Uno, the basic unit, which can be had for as low as 17 dollars from the internet if you can wait for shipping from Thailand or China, or around 27 dollars in-store from Radio Shack or fast USA shippers like SparkFun.
You can download the programming interface from the main Arduino website right away, and start playing around with it, exploring the basic examples that are included to get the hang of programming (it's basically a flavor of the "c++" programming language, very easy to learn and use.) Then when you have the Arduino, just start loading up the examples and playing around with changing stuff in the program to see what it does.
Then for specific applications, look on the web, there are millions of Arduino programs out there that can be modified to your specific needs.

I just whipped up this following sketch to show the use of the PWM outputs of the Arduino. The sketch above just cycles thru all the digital outputs turning them HIGH in sequence, with no "brightness" control. The sketch below just activates the six PWM outputs of the Uno and uses the potentiometer to control the fade rate as the PWM is swung thru its full range, fading the LEDs up to full brightness and back down to off. So a transistor on the PWM output can then be used to control whatever, downstream, like a motor speed or the current to an electrolysis cell.



/*******************************************************
Fader PWM Tester

This example shows how to fade an LED on pins 3,5,6,9,10,11
using the analogWrite() function.

This illustrates the Arduino "Pulse Width Modulation" control system.
The Uno uses these six pins for PWM, but the Mega can use all
the pins from 2 thru 13 for PWM.

Wire the LED anodes to each PWM pin, cathodes to 470R to Ground pin.

Modified from the Arduino "Fade" example sketch by TK, December 2013
Released to Public Domain
**********************************************************/

int led[] = {3,5,6,9,10,11}; // array of PWM pin numbers
int pinCount = 6;                  // how many PWM outputs in array
int n = 0;                              // just a counter
int brightness = 0;               // how bright the LED is
int fadeAmount = 1;            // PWM increment: how many points to fade the LED by each time thru loop
int potPin = 0;                     // potentiometer wiper to control fade rate
 
void setup()  {
  for(n=1;n<=pinCount;n++)
    pinMode(led[n], OUTPUT);
}

void loop()  {
  for(n=0;n<=pinCount;n++)
   // loop thru LED PWM pin array, set brightness
    analogWrite(led[n], brightness);   
  // change the brightness for next time through the loop:
  brightness = brightness + fadeAmount;
  // reverse the direction of the fading at the ends of the fade:
  if (brightness == 0 || brightness == 255) {
    fadeAmount = -fadeAmount ;
  }         
  delay(map(analogRead(potPin),0,1023,3,30)); 
  // reads potentiometer, maps reading to set fade rate PWM increment from 3 to 30 ms
}
/*************************************************************************/

TinselKoala

Here's another little sketch, showing how to use the pot to select which one of the 12 LEDs (or anything attached to a digital output) is turned on. This sketch sets the 12 digital pins to Outputs, then looks at the pot reading (which will be something from 0 to 1023 at the analog potPin) and maps that to a number from 2 to 13, then turns on the corresponding digital output. It checks to see if the pot has been moved, and if it has it turns the present LED off, so that only one LED is on at a time.

Elements illustrated in these three sketches can be combined as needed - you can use several pots to control which output is active, and the PWM rate or peak values, timing or sequencing, etc. or you can even use the "water level" as sensed by your system to control other parameters of operation.

The resistor readings from your water level sense system can be directly subbed into the "potPin" instead of the potentiometer in this sketch, so the LEDs will indicate the water level, and the top level can turn on an audio alarm just as your system does.


// WhichLED: uses the pot (or other voltage input) to control
// which of the 12 LEDs (digital outputs) is ON

int LEDpin = 0, potPin = 0, whichLED = 0, whichLEDold=0;

void setup() {
for (LEDpin = 2; LEDpin < 14; LEDpin++) pinMode(LEDpin, OUTPUT);
}

void loop(){
  whichLED = map(analogRead(potPin),10,1013,2,13);  // uses 10 and 1013 for pot endpoints to provide a "cushion" at the ends
  if(whichLED != whichLEDold) digitalWrite(whichLEDold, LOW);   // tests to see if pot setting has changed, turns off LED if so
  digitalWrite(whichLED, HIGH);   // turns selected LED on
  whichLEDold=whichLED;
}
 

ETA:

Adding the fading function to the above sketch, so that the selected LED fades in and out if it is capable of doing so:

// WhichLED: uses the pot to control
// which of the 12 LEDs (digital outputs) is ON and fading

int LEDpin = 0, potPin = 0, whichLED = 0, whichLEDold=0;
int brightness = 0, fadeAmount = 1;

void setup() {
  for (LEDpin = 2; LEDpin < 14; LEDpin++) pinMode(LEDpin, OUTPUT);
}

void loop(){
  whichLED = map(analogRead(potPin),10,1013,2,13);
  // uses 10 and 1013 for pot endpoints to provide a "cushion" at the ends
  if(whichLED != whichLEDold) digitalWrite(whichLEDold, LOW);
  // tests to see if pot setting has changed since last loop, turns off LED if it has changed
  analogWrite(whichLED, brightness);
  // turns selected LED on with fading
  brightness = brightness + fadeAmount;
  // reverse the direction of the fading at the ends of the fade:
  if (brightness == 0 || brightness == 255)
    fadeAmount = -fadeAmount ;
  delay(3);

  whichLEDold=whichLED; // remember which LED is active
}




TinselKoala

Sorry... I really didn't mean to hijack your thread. Your water level sensor can be used to feed into the Arduino for display and control, and it inspired me to fiddle around a little bit. I think Arduino control systems would probably help a lot of people with their circuit control and monitoring problems, and controlling an electrolysis cell is an ideal situation. The Arduino can switch the power mosfets on whatever schedule you can program into it, or do it in response to sensor inputs, whatever.

Anyhow, I decided to make a little video illustrating the sketches above, just to show that it's not really "rocket science" and it's easy to get started. No, I'm not an Arduino salesman, I just think they are really neat, kind of like a fully loaded Swiss Army Knife only electronic.

http://www.youtube.com/watch?v=cUvcnI3f7ec

ramset

WOW
Very Nice application for this water level indicator ,and excellent idea to intigrate arduino.

@Tinsel
Your are truly a very nice man and I hope things go well for you in this coming year.


have a good and safe Holiday

Chet

Whats for yah ne're go bye yah
Thanks Grandma

mscoffman

 
Hi; I happened to notice the following youtube video while I was watching
yours that *might* be a better liquid level solution for certain applications.  ;)
The reason is that yours uses liquid conduction of the end-use fluid. This might
be bad because you get a very small amount of electrolysis on each sensor probe. (solvable
to some extent by using an AC sense signal)  This can contaminiate the fluid or etch
out the probes in the long run. The varible amount of conductivity of the electrolyte
in the fluid is another potential problem as is the capacitive noise signal environment
of the fluid and it's container.

The displayed non-contact method (if the cicuit works reliably?) would be better if your
application doesn't mind having the small amount fluid heating supplied by each sensor.

http://www.youtube.com/watch?v=WDu2XFp5Flo

:S:MarkSCoffman