Servos motors with Arduino

Hi, I have built my own Arduino on a breadboard, it works fine with LEDs on all pins. I have built a temperature operated window opener for my greenhouse using a servo motor which works fine using a Arduino Uno. When I connect everything to my breadboard Arduino it don’t work. Is there something about the self built Arduino that is not the same as the adruino uno.

How can we help you when we cannot see what is being referenced ?

Show us a good schematic of your circuit.

Show us a good image of your ‘actual’ wiring.

Give links to components.


In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.

Use the </> icon from the ‘reply menu’ to attach the copied sketch.

And please specify that.

Thank you for your responses.
The breadboard Arduino is copied from the Arduino website, and is working fine.
Other components are: DS18B20 temperature sensor with 4.7 resistor, S53-20kg servo motor.
Code:
#include <Servo.h>
#include <OneWire.h>
#include <DallasTemperature.h>

int openPin = 7;//…LED on indicate window open
int closedPin = 8;//…LED on indicate window closed
Servo servo1;//…servo motor name

float temp = 0.0; // variable to store the measured temperaturevariabele (float = floating point number)
int oneWireBus = 10; // 1-wire pin //temperature sensor connected to arduino pin 10
OneWire oneWire(oneWireBus); // 1-wire instance on the oneWireBus pin
DallasTemperature sensors(&oneWire); // give the OneWire instance as parameter to the DallasTemperature library

void setup() {
servo1.attach (3);//…attach servo motor to arduino pin 3
pinMode (openPin, OUTPUT);//…
pinMode (closedPin, OUTPUT);//…
Serial.begin (9600);
Serial.print (temp);
sensors.begin();

}

void loop() {
int position;//…setup servo motor to move

sensors.requestTemperatures();          // read the temperature of all 1-wire sensors connected to the 1-wire bus

temp = sensors.getTempCByIndex(0); // get the temperature of the first sensors in Celcius (lists start with 0 not 1)
Serial.print("Temperature is: "); // print message without a newline
Serial.print(temp); // print the temperature with a newline
Serial.println (“c”);//…print c for centigrade after temperature reading
delay (10000);

if (temp > 23) {//…minimum temperature to open window

  digitalWrite (openPin, HIGH);//........turn off LED when window closed
  digitalWrite (closedPin, LOW);//.......turn on LED when window open
  delay (1000);//.........................delay for 1 second
 servo1.write (100);//...................move servo to 100 degrees
  
}

if (temp < 23) {//......................minimum temperature to close window
  
  digitalWrite (openPin, LOW);//.......turn on LED when window open
  digitalWrite (closedPin, HIGH);//........turn off LED when window closed
  delay (1000);//.........................delay for 1 second
  servo1.write (20);//.....................move servo to 0 degrees
}

}
Schematic: I didn’t draw a schematic.

My query is, is there a something in the Arduino Uno that isn’t in the Arduino on a breadboard.

In response to the it didn’t work, the temp sensor is okay but the servo doesn’t move.

@DavidTyrrell, your topic has been moved to a more suitable location on the forum.

So how are you powering the Servo ?

And your code is not within </> code-tags

I can think of one thing immediately. A Uno is built on a proper circuit board with good soldered connections. It is not built on a breadboard with low power and often high resistance connections.

Steve

Hi Steve, thanks for that. I have made my a Arduino using a proto board with soldered connections, would that be better from the resistance point. I am powering the board with a twelve volt plug-in power supply, passing it through a voltage regulator. I have tried using separate power for the servo, using a common negative.

Everything works fine using the UNO but not when I used my board.

Without a schematic and no reference other than "copied from the Arduino website" only you know what's different. And there are a lot of things on "the Arduino website".

One thing I wonder is if you're using the correct pin numbers. The IDE/Uno pin numbers aren't a direct match for the ATmega pin numbers.

Steve

Hi,
Please read the post at the start of any forum , entitled "How to use this Forum".

Can you post a schematic of your non working breadboard model?
Can you post some pictures of your breadboard model ?

Thanks.. Tom... :grinning: :+1: :coffee: :australia:

Thanks... Tom... :grinning: :+1: :coffee: :australia: