I am building an electric bike using only RC parts (bdlc motor, rc esc..)
now that it is working i wont to make it smarther by adding arduino.. my primary goal is to make some kind of current-power limiting becouse the rc esc doesn t have any.. so the idea is to control the esc using the servo library(tested, and working great) and monitor the current or the rpm of the motor and not allowing to much "throtle" when the current is higher than x, or not allowing a big difference in actual motor rpm and throttle position..
there is no problem when i am only measuring the rpm, but when i add other things in the code the measurment go crazy because it counts micros in a loop each time it reads a magnetic(or any other) switch, because the loop is taking longer for the added code, so i was wondering if there is any way to make some kind of "paralell" loops which dont have any "timing" interference..??
the other thing i want to add is a battery voltage monitor... i am planing of using a led bargraph, 4017 counter, and a voltage divider, but when i add this code to the rpm monitor code it goes even more crazy because of the different dellay times for the 4017 counter...
Now i wont to try measuring the current using a shunt resistor, but i am not sure how to connect all that...
I am new to electronics, adruino and programming, so all this is a great learning experience for me..
this is what i am not sure how to connect.. the voltage divider and the shunt resistor
the arduino is powered by the esc(which have constant 5v power supply) connected to the arduino 5v - this is tested and working fine
if i connect only the divider.. the -
to arduino gnd, and +
to analog pin i think that it woult work just fine (if the voltage stays under 5v)
if i connect the shunt the same way.. -
to gnd, +
to analog pin, i think that there is no problem too, it should work (off course under 5v)
but i am not sure in to conecting both at the same time.. maybe i am wrong..
i am not sure what will hapen with the arduino power supply if all that was connected, it would have -
from the esc, voltage divider and shunt connected to arduino gnd, +
from esc to 5v, and two other +
but through analog pins, coming from the same battery...
this is too confusing for me right now so i stoped working on this because i didnt wont fo burn something...
thanks for your time,