Solenoid with LCD!!!

Hi Arduinos,
I am relatively new to the Arduino.
I have a project to do, but I don't know how to start doing it !
I connect them but it doesn't work ! Also, I don't know how to write my colde .
I use 3 push buttons, 3 resister 2.2 om ,LCD to display the temperature which it will measure from solenoid , I also use Irf540 with 10 om.
I attached pic for solenoid I will wire it to 12 v .
please help me !

Step back from the problem. What are you trying to achieve?

PeterH:
Step back from the problem. What are you trying to achieve?

thanks for replying !
I can’t write my code I feel its so complicated!
I want to push first button to start measuring the temperature which it’s from currents in the solenoid will show me this message ,second button for the time , then the LCD display changing numbers from 1 to 5 when number 5 appears I have to push the button to see the temperature in this sec . the button last one when I push it will show me message tells that (Done !)
I use this LCD
http://www.sparkfun.com/tutorials/246

I find my self at lost , please help me !

I connect them but it doesn't work !

Connect what to where, we need a schematic.

3 resister 2.2 ohm

I hope you don't mean that.

temperature which it will measure from solenoid

How on earth do you get temperature from a solenoid?

I also use Irf540 with 10 om.

What's the FET for, to drive the solenoid? And why a 10ohm resistor?

I find my self at lost

You and me both :slight_smile:

Sorry Dana we need some real info.


Rob

the temperatue comes when the currents cross the solenoid it will heat it and, it will open " so we want to see which time and temperature make it open !

Solenoids don't "open" they are activated, and I've never heard of one that was activated by heat. And anyway you don't have any components for measuring heat in your parts list.

Do you perhaps mean a thermostat? As in something used to set the temperature for an air-conditioner or a fridge.


Rob

thanks Graynomad !
ok , if I want to contronl it how can I write the code ??? where should I wire the LCD ???

You can use pretty much any pins for an LCD, check out the LiquidCrystal library

http://arduino.cc/en/Reference/LiquidCrystal

Your buttons can connect to any digital pins set as inputs.

Your FET can connect to any digital pin set as an output. You turn it on with a command like

digitalWrite (13, HIGH);  // assuming the FET base it connected to pin 13

You already have the Arduino playground page that describes this.

Where the temperature comes into this I have no idea.

I’m afraid with no further explanation (especially regarding the temperature) there’s not much more I can say.


Rob

Thanks , Graynomad :slight_smile:

Watch the Arduino Videos on this channel, for someone with essentially no knowledge of electronics or programming in the Arduno environment, this is a must see tutorial series. It will answer many of your questions:

Sacman:
Watch the Arduino Videos on this channel, for someone with essentially no knowledge of electronics or programming in the Arduno environment, this is a must see tutorial series. It will answer many of your questions:

http://www.youtube.com/user/sciguy14/videos

Thanks Sacman ! it's really useful website ! :slight_smile:

First, put your code in code tags. That is the # sign on the toolbar above.

Second, I can see a ton of mistakes before you even get out of the Setup()

Look at your variable names, you declare them as one thing and then in setup you call them something different. I hope you understand why this won't work. I didn't go past that point. Fix that, use code tags and come back.

Also, you have three switch pins but you only set one to input and that one doesn't exist in you declarations. You have to set all of your digital pins as either INPUT or OUTPUT.

Also, the Arduino IDE is case sensitive so you can't use LCDPin in the declarations and then use lcdpin in the rest of the code.

Dana:

PeterH:
Step back from the problem. What are you trying to achieve?

thanks for replying !
I can't write my code I feel its so complicated!
I want to push first button to start measuring the temperature which it's from currents in the solenoid will show me this message ,second button for the time , then the LCD display changing numbers from 1 to 5 when number 5 appears I have to push the button to see the temperature in this sec . the button last one when I push it will show me message tells that (Done !)
I use this LCD
http://www.sparkfun.com/tutorials/246

I find my self at lost , please help me !

Please explain the bit about getting the temperature from the solenoid. A solenoid is an electromagnetic component which produces a force. Is does not tell you anything about the temperature. To read the temperature you would need a temperature sensor - there are various ones about that can interface easily with an Arduino. Perhaps your translation has picked the wrong word for this component?

There are so many errors there I hardly know where to start, and I'm not sure I should bother because you haven't answered any of my questions so far, but anyway...

LCDpin.write(254);

LCDpin is a number not an object with a .write() method, what you have there is the same as

13.write(254);

Then there's

pinMode(LCD,OUTPUT);

LCD is not defined anywhere.

pinMode(switchPin, INPUT);

switchPin is not defined anywhere and switchPinA and B are not used.

digitalWrite (LCDpin(254));

Total nonsense, equal to

digitalWrite (13(254));

Rob

Sacman:
First, put your code in code tags. That is the # sign on the toolbar above.

Second, I can see a ton of mistakes before you even get out of the Setup()

Look at your variable names, you declare them as one thing and then in setup you call them something different. I hope you understand why this won't work. I didn't go past that point. Fix that, use code tags and come back.

Also, you have three switch pins but you only set one to input and that one doesn't exist in you declarations. You have to set all of your digital pins as either INPUT or OUTPUT.

Also, the Arduino IDE is case sensitive so you can't use LCDPin in the declarations and then use lcdpin in the rest of the code.

Thanks for leads up me for this point ! I'm not familiar with C language , but I try to learn it :slight_smile:

Dana:

PeterH:
Please explain the bit about getting the temperature from the solenoid. A solenoid is an electromagnetic component which produces a force. Is does not tell you anything about the temperature. To read the temperature you would need a temperature sensor - there are various ones about that can interface easily with an Arduino. Perhaps your translation has picked the wrong word for this component?

I attached my solenoid , when the current cross it the iron get hotter than before >

Your answer makes no more sense to me than the original post. By 'solenoid' are you talking about a wire wound component? Is this a sensor or something you are trying to control? If it's a sensor, what does it sense and how? If it's something you're trying to control, what does it do and what are you trying to do with it?

Your circuit is wrong that will never work.

Just get the individual bits to work first befor trying to make them work together. People here are willing to help but you must answer the questions and you MUST post your code correctly, like you have been told.

I want to control the current which pass to solenoid > It's Shuttler controller !
I hope it's clear now ! how to control it ??
where should I put my LCD ???

# include <SoftwareSerial.h> LCDpin=13;

int switchpinA=6;

int switchpinB=7;

int switchpinC=8;

int powermosfetpin=2;


void setup ()

 {
  Serial.begin(9600); // set up serial port for 9600 baud
  pinMode(switchPin, INPUT);
  pinMode(powermosfetpin, OUTPUT);
 }

   void loop ()

   {

   if (digitalRead(switchPinA) == HIGH && buttonCounter == 1){
       digitalRead(switchPinB)== LOW;
       digitalRead(switchPinC)== LOW;
     digitalWrite(powermosfetpin, LOW);  //Do Not Fire solenoid

     {
   
  mySerial.write; // move cursor to beginning of first line
  mySerial.write;

  mySerial.write("                "); // clear display
  mySerial.write("                ");

  mySerial.write; // move cursor to beginning of first line
  mySerial.write;
 
  mySerial.write(" Push button B!");

} 
  buttonCounter = 0;

   }

  if (digitalRead(switchPinB) == HIGH && buttonCounter == 1){
      digitalRead(switchPinA)== LOW;
       digitalRead(switchPinC)== LOW;
  digitalWrite(powermosfetpin, HIGH);  //Fire solenoid

{

int x = ultrasonic.Ranging(C);

// ping the ultrasonic transducer Serial.println( x );

// for debugging int range = (float) x; char tempString[1] = "";

sprintf(tempString,"= %d Sec",range);

mySerial.write_string(5, 0,"Temperature", MENU_NORMAL);

mySerial.write_string(5, 1,"Measuring", MENU_NORMAL);

mySerial.write_string(5, 3," ", MENU_NORMAL);

// fudge to clear the line after the last reading

mySerial.write_string(5, 3,tempString, MENU_NORMAL);

// tempstring contains the Data delay(500); }

 digitalWrite(powermosfetpin, LOW);  //Return Fired Solenoid to off position

     buttonCounter = 0;

     }

      if (digitalRead(switchPinC) == HIGH && buttonCounter == 1){
           digitalRead(switchPinA)== LOW;
       digitalRead(switchPinB)== LOW;
      digitalWrite(powermosfetpin, LOW);  //Do Not Fire solenoid 

     {
  mySerial.write; // move cursor to beginning of first line
  mySerial.write;

  mySerial.write("                "); // clear display
  mySerial.write("                ");

  mySerial.write; // move cursor to beginning of first line
  mySerial.write;
 
  mySerial.write(" Done !");



      }

  }

I retry to write my code agian !

You are getting closer to code that might actually compile. Like everyone else, I don't fully understand what you are trying to do so electronically I am not sure it will work.

You are still not setting you pinmodes for the switches correctly.

You declare SwitchPinA, B and C. In your setup, you set pinmode for switchpin. This is not correct.

You're trying to use software serial but you have not set it up right. Are you using software serial or are you using the actual serial pins on the Arduino. This makes a big difference in how you code it. If you are actually using software serial then you have to declare it and start it:

SoftwareSerial mySerial(-1,?); //The ? should be whatever pin you have attached to your LCD.

And in the setup:

mySerial.begin(9600);

Further down you are calling a function that doesn't exist when you call mySerial.write_string();

These forums are great for helping you out in a jam or pointing you to resources that will help you get started but you are being too ambitious for your skill level which is clearly none.

Open up all of the examples in the IDE and try to figure out what they do. If you can't turn an LED on and off using a switch which you can't based on your code, the people on this forum are not going to do it for you. You have to be willing to learn what to do and let us help you get unstuck instead of just posting crap and hoping we will re-write it for you.

I agree, I can't understand what the project is about. If you are not able to describe it in English, use google translate. I don't know where the solenoid fits in the project at all.