Hi guys, recently my electronics packed up in my electric golf trolley.
The company no longer has parts, and my local electronics company couldn't fix the problem.
Unwilling to chuck the trolley, as it is in perfect condition, i decided i will embark into the arduino world.
This world is fascinating and a little daunting, i have only managed to program a thermistor in which outputs temperature into IDE on my screen.
Ok so the basic functions of the trolley are as follows:
12v Motor to spin one way (forward )
Potentiometer to control speed
LED bar to show the charge left in the battery.
Unfortunately the motor has no markings on it, but looking at similar trolleys on the market, i would say its between 160-180watts.
Rather than just state what i need and let everyone else sort it out for me. I have tried to do as much research as possible and come up with a drawing.
If anyone could let me know of any mistakes/improvements/advice, it would be much appreciated.
Furthermore the code supplied, is taken from sources on the web. Once i get the code corrected by someone and i know its correct, it will make it easier for me to study it, and apply it to my real life situation. Unfortunately i find it easier learning like this, rather than reading books and stuff.
EDIT: I forgot to mention that there is a simple switch that needs to be incorporated, im guessing this just goes inline with the 12v supplying the arduino.
int pot = 0;
int relay = 3;
int motorPin = 11;
int val = 0;
void setup() // run once, when the sketch starts
{
//Serial.begin(9600); // set up Serial library at 9600 bps
// pinMode(pot, INPUT); //don't need this
pinMode(relay, OUTPUT);
pinMode(motorPin, OUTPUT);
}
void getPot()
{
val = analogRead(pot);
val = constrain(val,90,255); //this restricts the analog value to between 90 and 255;
if(val=<90){
val = 0;
}
}
void run()
{
analogWrite(motorPin, val); //this will run the motor at the speed set by the pot value
}
void loop() // run over and over again
{
getpot(); //THIS CALLS THE FUNCTION NAMED getpot ABOVE WHICH SETS val BASED ON THE ANALOG INPUT
run(); //THIS CALLS THE FUNCTION NAMED run ABOVE
}