Hi, my name is swapnil. I am trying to make a water level controller using arduino. I refered many circuit ideas for different website and made my own design. Simulated it in Protues and it worked fine. Also i designed my PCB in eagle and started implementing.
Everything was going as per plan, but when i tried to test the input sensors voltage, its not showing correctly, also the program runs perfectly as desiered in protues but not after implementing practically.
one reason i think is ... that it may be because of the resitance values. but i am not sure what values are better with arduino pins
i have attache my protues file and arduino code and hex file.
Anyone have any idea.. how to tackle this problem.
Please post your Arduino sketch in your post using code tags so it looks like
this
Also please post a schematic diagram showing all components and their values. Post links to any special components you are using and a sample of the output from the sketch.
Do not trouble to post inputs or outputs from simulators, we use only real Arduino here!
hi paul and drew... thx for your reply.. i have attached proteus schematic image file and also the code...
i am not able to insert the code as paul requested, becuase it is showing message for exedding 9000 characters... so i have attached .ino file of the code. let me know... if that works....
pls check the code ans schematic .. not sure ...where i am going wrong...
THIS WAS WRONG, power enters from the switch, and then pulls the pin high and powers the LED.
when the switch is open, the LED brings the voltage to a lower level. see the schematic in post 6
I see your float sensors are doing two things.
digital pin 7 goes to float switch terrace_tank_1/4
terrace_tank_1/4 is closed, so that line is pulled to ground.
terrace_tank_1/4 is also connected to an LED, then a 220 ohm resistor.
when the switch is open, the LED is getting a higher voltage and will turn on, indicating that switch is open. when terrace_tank_1/4switch is closed, there is no voltage for the LED and it will be off.
is this what you are calling the "input sensor voltage'
That's a very complicated design! You have done well to get it working even on a simulator.
How far have you got with construction. There must be ways we can help you simplify the circuit design. I see 556 timers, 4017 multiplexers and various other components that the Arduino could probably replace with a little enginuity.
The code also could benefit from improvements to make it shorter and easier to understand. Just one example:
void mtrstat() /*----( Display Motor and Flow Status Function )----*/
{
if (mtrvar==1)
{
lcd.setCursor(0,3);
lcd.print("MOTOR-ON ");
}
else if (mtrvar==0)
{
lcd.setCursor(0,3);
lcd.print("MOTOR-OFF");
}
}/* --(End Motor and Flow Status Function loop )-- */
Could be shortened to:
void mtrstat() /*----( Display Motor and Flow Status Function )----*/
{
lcd.setCursor(0,3);
lcd.print("MOTOR-");
if (mtrvar==1) lcd.print("ON "); else lcd.print("OFF");
}/* --(End Motor and Flow Status Function loop )-- */
I was a little confused by the way the traces ran around the board. I like to show Vcc and a triangle and place all over the sheet and not have traces running on the schematic.
I moved a few things so I could visualize the layout better. in my mind.
these are the same files. the small one so it will fit on the post screen
Dear dave@ - thanks for the reply.... one thing u misunderstood...
Digital pins are delaced as logic low in void setup(), so LED will be of when initialised. Also LEDs are connected to GND via resistor, so pulling the digital pins to gnd and avoid pins to be in floating state.
VCC pin is connected to the sensor switch , which will give high voltage when closed and in turn give high voltage to LED, so LED will turn on when switch is closed (i.e. sensor detects water level).
Pin 6 (blue line) as u mention in ur post is connected directly to LED...
The problem i am facing is even when the connectivity is logically okk... but after implementing the circuit... it does not behave the same. I checked the voltages at the digital pins, but arduino does not take neccesary actions as per the code.
i have not calculated the resistance.... i took 220 ohm for most of LED in the circuit
Two things i want help in is that ....
a) are the values of the resistor very critical in this logic, if yes... what should be the values...
b) is the connectivity logically okk? i mean the switch and LED connections going to digital pins...
Also, "input sensor voltage" means that the voltage at the currosponding digital pins.
I am still not able to figure out.... what is wrong...
I see my misunderstanding. I see now that you use the float switch to supply voltage for the LED and pin6
when you open that switch you have the diode and it's voltage drop still in the circuit.
I would add a 10k from the Arduino to ground on pin6 to offer a path directly to ground and not rely on the pin being pulled to ground through the LED.
snmjack:
dave@ the suggestion is good... i will try to work on it... but it is still not solving my problem....
Maybe I do not understand your problem.
does the state change of the switch also change the state of pin6 and the LED ?
if that works all the time, then is your question about the program ?
Power connections are'nt shown for the UNO, 2 x 4017's and PCF8574A.
Is the UNO being powered separately?
D1 LED-GREEN (power led?) does not show a current limiting resistor.
Does the 7805 regulator have a heatsink? I suspect overheating as you have 31 leds that would draw about 20mA each and one relay coil that would need maybe 70mA and the UNO maybe 25-50mA.
dave@ adding a 10K, will still make the LED on when switch is closed??
Also, to clarify your doubt..... the state change of the switch, inturn make the LED on... but the voltage at the pin6 should be 5V, to make the decision... but the voltage drops to around 3V and below... which i dont know what is causing this... because VCC is directly connecting to the pin 6 after switch is closed.
Because of this ... arduino.. does not take any respective decision...
dlloyd@ In proteus... for UNO and other chips... power is supplied logically.. so these pins are not visible..
Also, thanks for pointing out the D1 LED resistor... will add one... thx..
yes dave... u r correct.. but in proteus.. the simulation automatically supplies the power to the UNO and other chips... so u can see.. that the pins are not visible in the schematic. For 556 chip.. the VCC and gnd pins are visible.. so have connected manually.
Secondaly.. i have taken care of common gnd and supply in Eagle PCB design... have attached the schematic and board files of eagle