Help for the Wire less Water Level Indicator for Programming the ARDUINO 328

Thread Starter

mkbutan

Joined Sep 30, 2008
297
Hi
I am new to ARDUINO and Programming in 'C'
I have design the Circuit for the Wire less WATER LEVEL indicator
with [ Empty 10% , 20% , 25% , 30% , 40% , 50% / HALF , 60% , 70% , 75% , 80% , 90% , 100% / FULL ]
to be display on the LCD
but
I don't know how to write the program for the same.
any help??????
 

Attachments

Thread Starter

mkbutan

Joined Sep 30, 2008
297
I can Switch ON and OFF the one LED on pin #12 of Arduino with an Switch on pin #3 with this code's
but don't know the idea how to solve my problem


Rich (BB code):
/*
  pin 12, when pressing a pushbutton attached to pin 2. 
  The circuit:
* LED attached from pin 12 to ground 
* pushbutton attached to pin 3 from +5V
* pushbutton attached to pin 4 from +5V
* pushbutton attached to pin 5 from +5V
* pushbutton attached to pin 6 from +5V
*/
const int buttonPin = 3;     // the pushbutton pin A
//const int buttonPin = 4;     // the pushbutton pin B
//const int buttonPin = 5;     // the pushbutton pin C
//const int buttonPin = 6;     // the pushbutton pin D
const int ledPin =  12;      // the LED pin 

int buttonState = 0;

void setup() 
{
    pinMode(ledPin, OUTPUT);      
    pinMode(buttonPin, INPUT);     
}

void loop()
{
    buttonState = digitalRead(buttonPin);
    if (buttonState == HIGH) 
{     
    digitalWrite(ledPin, HIGH);  
} 
  else 
{
    digitalWrite(ledPin, LOW); 
  }
}
 
Last edited by a moderator:

Thread Starter

mkbutan

Joined Sep 30, 2008
297
mkbutan,
How much are they paying YOU to design this circuit?

My dear the Ckt is all ready installed in my house OVER HEAD WATER TANK
and its working fine based on P89V51RD2
but i would like to run it on the ARDUINO 328 or MSP430 in place of P89V51RD2

and no one is Paying me any thing
Thanks
 

tshuck

Joined Oct 18, 2012
3,534
Since this is not time-sensitive, take your time, learn how to use the individual components.

Since you refuse to draw a proper schematic, you'll find many people will not offer much help. They can't read the markings on your napkin. You haven't described your hardware, so we don't know what interface to tell you to use.

We cannot instinctively know what components are used in this system and before we can help you, you must describe the system to us.
 

Thread Starter

mkbutan

Joined Sep 30, 2008
297
Since this is not time-sensitive, take your time, learn how to use the individual components.

Since you refuse to draw a proper schematic, you'll find many people will not offer much help. They can't read the markings on your napkin. You haven't described your hardware, so we don't know what interface to tell you to use.

We cannot instinctively know what components are used in this system and before we can help you, you must describe the system to us.
THANKS

but I don't have the Software to draw the Proper schematic
but I will draw another one neatly with proper Component marking on it.

bye the way its not NAPKIN its white paper with LOW RESOLUTION scanning for UPLOADING on the FORUM
 

tshuck

Joined Oct 18, 2012
3,534

Thread Starter

mkbutan

Joined Sep 30, 2008
297
pl let me know how to make it work?

what type of FUNCTION should be use here?

Rich (BB code):
#include<stdio.h>
#include<conio.h>
void main()
{
     int a,b,c,d;
     printf("Enter the Val of A,B,C,D");
     scanf ("%d,%d,%d,%d",&a,&b,&c,&d);
     printf("Val of a,b,c,d",%d,%d,%d,%d);
     getch();
     }

????????
????????
????????

/*
int 
{
    if(a=0&&b=0&&c=0&&d=0)
    printf("%a,%b,%c,%d",is "00%" EMPTY);//0000=00
    }
    {
    if(a=0&&b=0&&c=0&&d=1)
    printf("%a,%b,%c,%d",is "10%" );//0001=01
    }
    {
    if(a=0&&b=0&&c=1&&d=0)
    printf("%a,%b,%c,%d",is "20%" );//0010=02
    }
    {
    if(a=0&&b=0&&c=1&&d=1)
    printf("%a,%b,%c,%d",is "25%" );//0011=03
    }
    {
    if(a=0&&b=1&&c=0&&d=0)
    printf("%a,%b,%c,%d",is "30%" );//0100=04
    }
    {
    if(a=0&&b=1&&c=0&&d=1)
    printf("%a,%b,%c,%d",is "40%" );//0101=05
    }
    {
    if(a=0&&b=1&&c=1&&d=0)
    printf("%a,%b,%c,%d",is "50%" );//0110=06
    }
    {
    if(a=0&&b=1&&c=1&&d=1)
    printf("%a,%b,%c,%d",is "60%" );//0111=07
    }
    {
    if(a=1&&b=0&&c=0&&d=0)
    printf("%a,%b,%c,%d",is "70%" );//1000=08
    }
    {
    if(a=1&&b=0&&c=0&&d=1)
    printf("%a,%b,%c,%d",is "75%" );//1001=09
    }
    {
    if(a=1&&b=0&&c=1&&d=0)
    printf("%a,%b,%c,%d",is "80%" );//1010=10
    }
    {
    if(a=1&&b=0&&c=1&&d=1)
    printf("%a,%b,%c,%d",is "90%" );//1011=11
    }
    {
    if(a=1&&b=1&&c=0&&d=0)
    printf("%a,%b,%c,%d",is "100%" FULL);//1100=12
    }
    {
    if(a=1&&b=1&&c=0&&d=1)
    printf("%a,%b,%c,%d",is "100" Alarm);//1101=13
    }
    {
    if(a=1&&b=1&&c=1&&d=0)
    printf("%a,%b,%c,%d",is "xxx%" );//1110=14
    }
    {
    if(a=1&&b=1&&c=1&&d=1)
    printf("%a,%b,%c,%d",is "xxx%" );//1111=15
    }
 */
 

tshuck

Joined Oct 18, 2012
3,534
pl let me know how to make it work?

what type of FUNCTION should be use here?
We don't know what you are trying to do! You refuse to make a schematic and refuse to describe your hardware. How can you expect anyone to help you when you won't even do the minimum for others to understand your system!?
 

Thread Starter

mkbutan

Joined Sep 30, 2008
297
I have put one FUNCTION (Display) in the code's
but still not functional

is there any way by which we can convert BCD to DEC code's and can be printed out as output

I know its wrong please help me to make it right
thanks
[ the CODE's is for 'C' not for 'ARDUINO' ]


Rich (BB code):
#include<stdio.h>
#include<conio.h>
void display(int z)
int main(void)
{
     int a,b,c,d;
     int x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15;
     x0=00;
     x1=10;
     x2=20;
     x3=25;
     x4=30;
     x5=40;
     x6=50;
     x7=60;
     x8=70;
     x9=75;
     x10=80;
     x11=90;
     x12=100;
     x13=0;
     x14=0;
     x15=0;
     printf("Enter the Val of A,B,C,D\n");
     scanf("%d,%d,%d,%d",&a,&b,&c,&d);
     printf("Val of a,b,c,d,%d,%d,%d,%d",a,b,c,d);
     display(int z)
     getch();
     }


{

    void display(int z)

{
    if(a==0&&b==0&&c==0&&d==0)
    printf("%a,%b,%c,%d is 00% EMPTY",x0);//0000=00
    }
{
    if(a==0&&b==0&&c==0&&d==1)
    printf("%a,%b,%c,%d is 10%",x1);//0001=01
    }
{
    if(a==0&&b==0&&c==1&&d==0)
    printf("%a,%b,%c,%d is 20%",x2);//0010=02
    }
{
    if(a==0&&b==0&&c==1&&d==1)
    printf("%a,%b,%c,%d is 25%",x3);//0011=03
    }
{
    if(a==0&&b==1&&c==0&&d==0)
    printf("%a,%b,%c,%d is 30%",x4);//0100=04
    }
{
    if(a==0&&b==1&&c==0&&d==1)
    printf("%a,%b,%c,%d is 40%".x5);//0101=05
    }
{
    if(a==0&&b==1&&c==1&&d==0)
    printf("%a,%b,%c,%d is 50%",x6 HALF);//0110=06
    }
{
    if(a==0&&b==1&&c==1&&d==1)
    printf("%a,%b,%c,%d is 60%",x7);//0111=07
    }
{
    if(a==1&&b==0&&c==0&&d==0)
    printf("%a,%b,%c,%d is 70%",x8);//1000=08
    }
{
    if(a==1&&b==0&&c==0&&d==1)
    printf("%a,%b,%c,%d is 75%",x9);//1001=09
    }
{
    if(a==1&&b==0&&c==1&&d==0)
    printf("%a,%b,%c,%d is 80%",x10);//1010=10
    }
{
    if(a==1&&b==0&&c==1&&d==1)
    printf("%a,%b,%c,%d is 90%",x11);//1011=11
    }
{
    if(a==1&&b==1&&c==0&&d==0)
    printf("%a,%b,%c,%d is 100% FULL",x12);//1100=12
    }
{
    if(a==1&&b==1&&c==0&&d==1)
    printf("%a,%b,%c,%d is 100% ALARM",x13);//1101=13
    }
{
    if(a==1&&b==1&&c==1&&d==0)
    printf("%a,%b,%c,%d is xXx",x14 );//1110=14
    }
{
    else(a==1&&b==1&&c==1&&d==1)
    printf("%a,%b,%c,%d is XxX",x15);//1111=15
    }

}
 

Thread Starter

mkbutan

Joined Sep 30, 2008
297
We don't know what you are trying to do! You refuse to make a schematic and refuse to describe your hardware. How can you expect anyone to help you when you won't even do the minimum for others to understand your system!?
thanks its not for the ckt its about Program CODE
 

Thread Starter

mkbutan

Joined Sep 30, 2008
297
##1
I think the (Tx section) have 00-15(0000-1111) binary input as a switch in the water tank (here we use 00-13(0000-1101) for the sensing switches in the tank) and 14(1110)turn on the audio (UM66) and 15(1111) to turn off the tank input.
The 16-04 Multiplexer convert the 16 I/P to 04 Hex (0000-1111) which will be Tx via HT12E

##2
and the (RX Section) have 04 O/P via HT12D and fed to 04-16 De-Multiplexer and will light the LED indicator as 00-13 (0000-1101) with
[ 00% , 10% , 20% , 25% , 30% , 40% , 50% , 60% , 70% , 75% , 80% , 90% , 100% ] 14(1110) turn on the audio (UM66) and 15(1111) to turn off the tank input.


##3
and the Arduino 328 will have pin no. 3,4,5 & 6 from HT12D as an Binary I/P as (000-1111) which to be displayed on the LCD of 2x16 as
[ 00% / Empty 10% , 20% , 25% , 30% , 40% , 50% / HALF , 60% , 70% , 75% , 80% , 90% , 100% / FULL ] from the pin no. 7,8,9,10,11,12 &13 of the ARDUINO 328...

The tx/rx is working I would like to add the ARDUINO or the MSP430 with it.

I just wanted to know how to write code for the ARDUINO 328
which have 4 pins input A,B,C,D as (0000 to 1111) on Arduino pin no 3,4,5 & 6
and the output to be displayed on the LCD as desired. the Arduino 328 will have
pin no. 3,4,5 & 6 from HT12D as an Binary I/P as (000-1111)
which to be displayed on the LCD of 2x16 as
[ Empty 10% , 20% , 25% , 30% , 40% , 50% / HALF , 60% , 70% , 75% , 80% , 90% , 100% / FULL ]
from the pin no. 7,8,9,10,11,12 &13 of the ARDUINO 328

any IDEA pl ????
 

tshuck

Joined Oct 18, 2012
3,534
I/P = input?
o/P = output?
##1
I think the (Tx section) have 00-15(0000-1111) binary input as a switch in the water tank (here we use 00-13(0000-1101) for the sensing switches in the tank) and 14(1110)turn on the audio (UM66) and 15(1111) to turn off the tank input.
The 16-04 Multiplexer convert the 16 I/P to 04 Hex (0000-1111) which will be Tx via HT12E
A multiplexer has only one output. You must mean an encoder. It is not converting to 04 HEX. It is encoding the value to 4 bits, or one hexadecimal number.

##2
and the (RX Section) have 04 O/P via HT12D and fed to 04-16 De-Multiplexer
this is a decoder...

##3
and the Arduino 328 will have pin no. 3,4,5 & 6 from HT12D as an Binary I/P as (000-1111) which to be displayed on the LCD of 2x16 as
[ 00% / Empty 10% , 20% , 25% , 30% , 40% , 50% / HALF , 60% , 70% , 75% , 80% , 90% , 100% / FULL ] from the pin no. 7,8,9,10,11,12 &13 of the ARDUINO 328...

The tx/rx is working I would like to add the ARDUINO or the MSP430 with it.

I just wanted to know how to write code for the ARDUINO 328
which have 4 pins input A,B,C,D as (0000 to 1111) on Arduino pin no 3,4,5 & 6
and the output to be displayed on the LCD as desired. the Arduino 328 will have
pin no. 3,4,5 & 6 from HT12D as an Binary I/P as (000-1111)
which to be displayed on the LCD of 2x16 as
[ Empty 10% , 20% , 25% , 30% , 40% , 50% / HALF , 60% , 70% , 75% , 80% , 90% , 100% / FULL ]
from the pin no. 7,8,9,10,11,12 &13 of the ARDUINO 328

any IDEA pl ????

Normally, I'd say read the port and shift as necessary until you get the bits like this: [0 0 0 0 (pin6) (pin5) (pin4) (pin3)] as a 8-bit variable, but, since I don't know if you have access to the ports like this in Arduino, I'll give you a general solution:
read in pins 3,4,5,and 6 and store them into a variable with each bit having different weights.
As in, and this is probably the wrong code
Rich (BB code):
unsigned char data = digitalRead(PIN6) << 3 | digitalRead(PIN5) << 2 | digitalRead(PIN4) << 1 | digitalRead(PIN3);
After that, it should be pretty easy to display the data on the LCD, switch on the data and push "XX%" to the LCD, as there are libraries for everything on Arduino...
 

Thread Starter

mkbutan

Joined Sep 30, 2008
297
now also its not correct
please help
error on Line #31
\4-16v1.c|31|error: syntax error before '{' token|

Rich (BB code):
#include<stdio.h>
#include<conio.h>
void display(int z);
int main(void)
{
     int a,b,c,d;
     int x[16] = {0,10,20,25,30,40,50,60,70,75,80,90,100,100,100,100};

     printf("Enter the Val of A,B,C,D\n");
     scanf("%d,%d,%d,%d",&a,&b,&c,&d);
     printf("Val of a,b,c,d,%d,%d,%d,%d",a,b,c,d);

void display(int z);
{
  int index = a*8 + b*4 + c*2 + d;
   printf("%d, %d, %d, %d is %d %%", a, b, c, d, x[index]);
   getch();
     }
     }




    void display(int z)
    {
        int a,b,c,d;
     int x[16] = {0,10,20,25,30,40,50,60,70,75,80,90,100,100,100,100};

    }

    {


{
    if(a==0 && b==0 && c==0 && d==0)
    printf("%d,%d,%d,%d is %d%% EMPTY",a,b,c,d,x[0]);//0000=00
    }
{
    if(a==0 && b==0 && c==0 && d==1)
    printf("%d, %d, %d, %d is %d %%", a,b,c,d, x[1]);//0001=01
    }
{
    if(a==0 && b==0 && c==1 && d==0)
    printf("%d, %d, %d, %d is %d %%", a,b,c,d, x[2]);//0010=02
    }
{
    if(a==0 && b==0 && c==1 && d==1)
    printf("%d, %d, %d, %d is %d %%", a,b,c,d, x[3]);//0011=03
    }
{
    if(a==0 && b==1 && c==0 && d==0)
    printf("%d, %d, %d, %d is %d %%", a,b,c,d, x[4]);//0100=04
    }
{
    if(a==0 && b==1 && c==0 && d==1)
    printf("%d, %d, %d, %d is %d %%", a,b,c,d, x[5]);//0101=05
    }
{
    if(a==0 && b==1 && c==1 && d==0)
    printf("%d, %d, %d, %d is %d %%", a,b,c,d, x[6]);//0110=06
    }
{
    if(a==0 & &b==1 && c==1 && d==1)
    printf("%d, %d, %d, %d is %d %%", a,b,c,d, x[7]);//0111=07
    }
{
    if(a==1 && b==0 && c==0 && d==0)
    printf("%d, %d, %d, %d is %d %%", a,b,c,d, x[8]);//1000=08
    }
{
    if(a==1 && b==0 && c==0 && d==1)
    printf("%d, %d, %d, %d is %d %%", a,b,c,d, x[9]);//1001=09
    }
{
    if(a==1 && b==0 && c==1 && d==0)
    printf("%d, %d, %d, %d is %d %%", a,b,c,d, x[10]);//1010=10
    }
{
    if(a==1 && b==0 && c==1 && d==1)
    printf("%d, %d, %d, %d is %d %%", a,b,c,d, x[10]);//1011=11
    }
{
    if(a==1 && b==1 && c==0 && d==0)
    printf("%d, %d, %d, %d is %d %%", a,b,c,d, x[12]);//1100=12
    }
{
    if(a==1 && b==1 && c==0 && d==1)
    printf("%d, %d, %d, %d is %d %%", a,b,c,d, x[13]);//1101=13
    }
{
    if(a==1 && b==1 && c==1 && d==0)
    printf("%d, %d, %d, %d is %d %%", a,b,c,d, x[14]);//1110=14
    }
{
    else(a==1 && b==1 & &c==1 && d==1)
    printf("%d, %d, %d, %d is %d %%", a,b,c,d, x[15]);//1111=15
    }

}
 
Top