First time project is almost complete.! After 6 month, a few burned out hbridges, late nights, hours on forums, my DC motor is under my control! ]:slight_smile: :stuck_out_tongue_closed_eyes: HAHA! "kinda"
I am using a Arduino Micro with a, Sparkfun L298 Hbridge motor shield. I have a photocell and one LM35s with a DS18B.

Everthing works, but the Arduino get very hot!! I have tried almost ever wire unplugged, tried disconnecting 12v power, tried switching limit switches to the motor directional pin instead of the CSB pin on motor shield. STILL HOTT ]:slight_smile: I have copied my code, in hopes that someone can take a look at it. Can having the pin high all the time make it hot? I have the limit switches on the CSB enable voltage pin. So, when the gate reaches it's destination and trips the switch it breaks the 11 and 12 pin, but they stay high in the code. Can that make the board hot? Also, when I run code for just the LM 35 temp sensor the reading is very consistent, but when I run it in my code it fluctuates almost 9 degrees.

thank you in advance for your time!!

#include <OneWire.h>
#include <DallasTemperature.h>

// Data wire is plugged into port 6 on the Arduino
#define ONE_WIRE_BUS 6

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);

// These constants won't change:
float tempC;
int tempPin = 1;  // temp sensor is plugged into analog pin 1 LM35
int fan = 5;  // led is connected to pin 13

int analogPin = A0;    // to photocell on 0
int ledPin = 13;       // pin that the LED is attached to
int threshold = 30;   // an arbitrary threshold level that's in the range of the analog input
int motoru = 10; // pin 10 motor up
int motord = 9; // pin 9 motor down
int motorenable = 8;//enable motor
int voltagedown = 11; //CSB pin on uk1122 shield
int voltageup = 12;   //CSB pin on uk1122 shield
int ledopen = 3; //LED red
int ledclose = 2; //LED green

void setup() {
  // initialize the LED pin as an output
  Serial.begin(9600); // start serial port
  Serial.println("Dallas Temperature IC Control Library Demo");
    // Start up the library
  pinMode(motorenable, OUTPUT);
  pinMode(motoru, OUTPUT); // set motor up pin 10 to up position
  pinMode(motord, OUTPUT); // set motor down pin 9 to down position
  pinMode(voltageup, OUTPUT); 
  pinMode(voltagedown, OUTPUT); //led down red
  pinMode(ledopen, OUTPUT); //led down red
  pinMode(ledclose, OUTPUT); //led down red
  pinMode(fan, OUTPUT); // turn on fan

  // initialize serial communications:

void loop() {
   tempC = analogRead(tempPin);
   tempC = (5.0*tempC*100.0)/1024.0; // will convert analog input into temp
  // read the value of the Photocell:
  int analogValue = analogRead(analogPin);
// open door
  // if the analog value is high enough, turn on the LED:
  if (analogValue > threshold) {
  digitalWrite(voltageup, HIGH); // voltage from motor shield
  digitalWrite (motorenable, HIGH); //enable
  digitalWrite (motoru, HIGH); //motor up
  digitalWrite  (motord, LOW); // pin 9 low
  digitalWrite (ledopen,HIGH); // red led on
  digitalWrite (ledclose,LOW); // off
  Serial.print("DANGER__Coop Door is OPEN "); //print
  else {
    // Close door
  digitalWrite(voltageup,LOW); //voltage 
  digitalWrite (motorenable, HIGH); //enable
  digitalWrite (motoru, LOW); // pin 9 low
  digitalWrite  (motord, HIGH); //pin 10 high motor down
  digitalWrite(voltagedown, HIGH);
  digitalWrite (ledopen, LOW); //led off
  digitalWrite (ledclose,HIGH);// green led on closed
  Serial.println("GOODNIGHT  Door is CLOSED ");
  if (tempC>60)
  digitalWrite(fan, HIGH); //turn fan on
   digitalWrite(fan, LOW);

  // print the analog value:
  Serial.println(" Coop ");
  Serial.print("TempC... ");
  delay(1000);        // delay in between reads for stability
   // call sensors.requestTemperatures() to issue a global temperature 
  // request to all devices on the bus
  sensors.requestTemperatures(); // Send the command to get temperatures
  Serial.print("Control Box Temp (index 0) is: ");

moderatore: please add code tags, ==> # button above smileys.

I don't need to see your code . I need to see a schematic of how you connected the motor driver to the arduino and how you connected the power source to the arduino and the motor shield. Leave nothing out. Delete your code. We don't need that. It has absolutely NO bearing on your post title. Is that clear ? Take a photo of your circuit from directly above so we can see the wiring and post the photo of the circuit and the schematic.

The code can't make your micro "hot" the power used is a function of the clock speed.

Which part of your micro is getting hot? Are there any other effects?


Why do you have two Serial.begin(9600); in setup()?

I have attached a photo of the control box.

thank you.

Where is the schematic of how you wired it up ? I can't see how the arduino input voltage is connected .
What is the voltage to the arduino and where is it connected ?
Do the motor driver and arduino have a common ground ?
Where is the power coming from ?
What are all those components on the breadboard ?
Draw a schematic and take a post a photo of it.