Maker Pro
Maker Pro

How to connect electronic electricity system?

LBT

Apr 23, 2012
7
Joined
Apr 23, 2012
Messages
7
I have attached a drawing of all my components but have no idea about how to collect the system and how to code the Arduino.
Shortly the system should go from the solarcells where power is generated for the batteries. The solution should be that when you press the button, there is running electricity in the metal at the end for 1 min.
Hope someone can help. I am totally new to this.
Thanks!
 

Attachments

  • Technical overview.png
    Technical overview.png
    14.6 KB · Views: 187

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
Have you visited any Arduino forums? This is the most basic of basic coding, and a few hours going over their forums and example code should provide you plenty of insight into the coding end...

The Arduino is serious overkill for this buy, yeah I regress...
 

LBT

Apr 23, 2012
7
Joined
Apr 23, 2012
Messages
7
So I can find a similar code on an arduino.
How do I put the rest of the components together? I have no experience in this field.
Why is an arduino overkill?
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
So I can find a similar code on an arduino.

Yes, I'm 100% sure you can find button detection and timer/delay/pause code...

Why is an arduino overkill?

Because the delay can be accomplished with a few dollars worth of parts using a simple 555 timer (or simple micro design), how much did you spend on the Arduino?

How do I put the rest of the components together? I have no experience in this field.

You selected the components, surely you have some idea how they all go together?

I personally don't mind helping but I do like to see the person asking for help at least trying and learning something in the process, instead of me just giving the answer...
 

LBT

Apr 23, 2012
7
Joined
Apr 23, 2012
Messages
7
About how to collect the components: I have an idea about in which order they should go (as on the drawing) but I am not sure, for example, where the wire from the metal object should go on the relay. An I am not sure which pins on the arduino I should use? I have attached a more detailed drawing.
About the coding:
Can I combine these two sketches in some way?:


Blink without Delay:

const int ledPin = 13;

int ledState = LOW;
long previousMillis = 0;

void setup() {

pinMode(ledPin, OUTPUT);
}

void loop()
{

unsigned long currentMillis = millis();

if(currentMillis - previousMillis > interval) {

previousMillis = currentMillis;


if (ledState == LOW)
ledState = HIGH;
else
ledState = LOW;


digitalWrite(ledPin, ledState);
}
}

AND

Button


const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin

int buttonState = 0; // variable for reading the pushbutton status

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

void loop(){
buttonState = digitalRead(buttonPin);

if (buttonState == HIGH) {
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin, LOW);
}
}
 

Attachments

  • Technical overview.png
    Technical overview.png
    18.9 KB · Views: 172

LBT

Apr 23, 2012
7
Joined
Apr 23, 2012
Messages
7
I worked a bit on it.


// constants won't change. They're used here to
// set pin numbers:
const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin

// variables will change:
int buttonState = 0; // variable for reading the pushbutton status

void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}

void loop(){
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);

// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
millis() = 0;
}
if (millis() >= 60000){
// turn LED off:
digitalWrite(ledPin, LOW);
}
}


About how to collect my components, I an also not sure about how the arduino is connected to the buttons and the delay. Which wires or cables should I use?
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
You will need a transistor on the Arduino output pin to drive the relay, the Arduino output pin isn't strong enough on it's own...

Look at the data sheet for your relay, or post a link to it here...
 

GreenGiant

Feb 9, 2012
842
Joined
Feb 9, 2012
Messages
842
I hope that the 4Ah is not the actual rating for your "car" batteries

car batteries typically are in the 75Ah range

Just make sure that you have the math worked out right for everything
 

LBT

Apr 23, 2012
7
Joined
Apr 23, 2012
Messages
7
GreenGiant: the 4 Ah is right though. It is a motorcycle battery.

CocaCola: How do I know if I need a transistor and which kind?
 

jackorocko

Apr 4, 2010
1,284
Joined
Apr 4, 2010
Messages
1,284
CocaCola: How do I know if I need a transistor and which kind?

The datasheet you linked to says the coil has a MAX rating of .45W you divide this buy the coil voltage 12V.

.45W/12V = 0.037A

roughly == 40mA needed from the arduino to drive the relay

According to the information here 40mA is the max.
DC Current per I/O Pin ........... 40.0 mA
You are literally right on the verge. Using a transistor will not hurt you in the least bit. A gain of at least 10 with a minimum of 4mA base current. Almost any all-purpose NPN transistors fit this bill. 2n3904 2n2222 etc
 
Last edited:

LBT

Apr 23, 2012
7
Joined
Apr 23, 2012
Messages
7
Ok thanks.
Could you maybe give me advise about how to connect the system? What should go where and which wires/cables do I need for this?
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
The datasheet you linked to says the coil has a MAX rating of .45W you divide this buy the coil voltage 12V.

.45W/12V = 0.037A

roughly == 40mA needed from the arduino to drive the relay

According to the information here 40mA is the max.

The Arduino is at 3.3v or 5.0v so it can't source/sink the 12 volts required, so the transistor is needed regardless... ;)
 
Top