.I've been working on a vaccum cleaner. It's from a 12v black and Decker vaccum and some tank tread robot. I bought 3 6 v sealed lead acid batteries to run the motors and it lasts a few hours if I keep it as it is ( I haven't added the Arduino board yet) I bought a osepp motor shield and would like to run the Arduino on the same power as the vaccum motor, but I don't want to burn the board. Would a resistor splice to the VIN for the 9v plug on an uno work? And can I run in parallel to the batteries inline to the motor shield?
No. Just use one battery for arduino.
Like the 9v ? Could I safely have Lithium rechargeable for the board and SLA for the motors? I'm trying to make it fully solar.
The Vin and barrel jacks on the Uno are not 9V, they work with 7V upto at least 12V (it depends on current load on the 5V pin how much higher you can take it, the on-board regulator has to dissipate the heat).
I have a 9v powering the Arduino currently with the 2 6v wired to the motor shield. It would be much simpler to run a DIY regulator/ surge protector but I'm getting by for testing.the black and Decker can do 12v but not the tank frame motors.there made for 3'c' batteries. I was thinking resistors in series and a cap in parallel just to keep them safe.i am really new any advice is appreciated.
Update: afmotor.h works great. Finished product needs work on the code but all sensors work.. will post sketch when it works better. Voltage not high enough for vaccum.. it spun for like 30 seconds and tried to spin. Do y need to use release after brake?
Well I've been troubleshooting and I tried a separate circuit for the vaccum and the board/ motor/shield. Afmotor motor test works and using the internal pull-up resistor works but the sketch I uploaded does not move. The LCD will get all glitchy even with the vaccum on a separate circuit. Would a loose connection do this? The sketch I'm using is on my computer. When I port it I will post. I almost feel like there a short because it makes a click noise when I touch the sensors..
EDIT: pretty sure there was a short from the lcd and the motor shield gnd. here is the sketch that works
// Adafruit Motor shield library
// copyright Adafruit Industries LLC, 2009
// this code is public domain, enjoy!
#include <AFMotor.h>
AF_DCMotor mr(1);
AF_DCMotor mt(2);
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Motor test!");
// turn on motor
mr.setSpeed(200);
mr.run(RELEASE);
mt.setSpeed(200);
mt.run(RELEASE);
}
void loop() {
uint8_t i;
Serial.print("tick");
mt.run(FORWARD);
mr.run(FORWARD);
for (i=0; i<255; i++) {
mt.setSpeed(i);
mr.setSpeed(i);
delay(10);
}
for (i=255; i!=0; i--) {
mt.setSpeed(i);
mr.setSpeed(i);
delay(10);
}
Serial.print("tock");
mr.run(BACKWARD);
mt.run(BACKWARD);
for (i=0; i<255; i++) {
mt.setSpeed(i);
mr.setSpeed(i);
delay(10);
}
for (i=255; i!=0; i--) {
mr.setSpeed(i);
mt.setSpeed(i);
delay(10);
}
Serial.print("tech");
mr.run(RELEASE);
mt.run(RELEASE);
delay(1000);
}
and this is the sketch that doesn't work:\
#include <AFMotor.h>
#include <LiquidCrystal.h>
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
//#define trigPin 8
//#define echoPin 9
#define ir1 7 //right
#define ir2 6 //left
AF_DCMotor mright(1);//right
AF_DCMotor mleft(2);//left
AF_DCMotor mtor(4);//vaccum
void setup()
{ lcd.begin(16, 2);
Serial.begin(9600);
//pinMode(trigPin, OUTPUT);
//pinMode(echoPin, INPUT);
pinMode(ir1, INPUT_PULLUP);
pinMode(ir2, INPUT_PULLUP);
mright.setSpeed(200);
mright.run(RELEASE);
mtor.setSpeed(0xEA);
mtor.run(RELEASE);
mleft.setSpeed(200);
mleft.run(RELEASE);
lcd.print("vaccum");
}
void loop() {
lcd.setCursor(0, 1);
mtor.run(FORWARD);
int duration, distance;
int flag,val1,val2;
val1=digitalRead(ir1);val2=digitalRead(ir2);
//Serial.println(val1);Serial.println(val2);
/digitalWrite(trigPin, HIGH);delayMicroseconds(1000);
digitalWrite(trigPin, LOW);duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;if(distance >= 200 || distance <= 0){lcd.print("Out of range");}
else{lcd.print(distance);lcd.print(" cm");}delay(500);/
if(val1==1 &&val2==1){
mleft.run(FORWARD);
mright.run(FORWARD);delay(999);} else {if(val1==0){ mright.run(BACKWARD);mleft.run(BACKWARD);delay(333);mleft.run(FORWARD);mright.run(BACKWARD);delay(333);}
if(val2==0){ mright.run(BACKWARD);mleft.run(BACKWARD);delay(333);mleft.run(BACKWARD);mright.run(FORWARD);delay(333);}
}
mleft.run(FORWARD);
mright.run(FORWARD);
delay(3000);
lcd.print(val1);
lcd.print(val2);
mleft.run(RELEASE);
mright.run(RELEASE);
lcd.print("mofizzle");
}