Basically (for whatever reason) I can't get data from my EV controller, and I have to resort on "intercepting" signal with my own way. So far I got speed from "vss pulse", amp draw from current sensor, and some opto-module to get various state of light switches (turn, high beam, etc.). Everything is "passive" (parallel) and can work without the arduino.
The one that baffle me is on how to get the mode switches.
The way the controller works in changing mode is to simply connect mode cables to ground (see picture atttached).
When they are not switched/connected to ground, it reads 1.2v –this is measured between Arduino pin 12 and ground. But Arduino digitalRead() returns 0
And when I switch/connect it to ground, pin 12 reads 0v.. but digitalRead() still returns 0
Can somebody explain why or how can I tap into this cable?
I really just need an on/off state, nothing fancy.
Thanks for the reply.
Sorry I forgot to mention that: All circuit has common ground (the same battery)
The arduino runs via a voltage regulator which has common ground.
1.2v not enough to register as HIGH <-- This answers it.
stormizer:
1.2v not enough to register as HIGH <-- This answers it.
Any ideas on what to do?
Use analog inputs, if you can spare them. If not, use analog comparators such as LM392N or similar. LM392N has 2 comparators in an 8-pin dip. You will need a couple of resistors as a voltage divider (eg. 10K & 47K) to make a a voltage of perhaps 0.8~1V to compare with the signals from the ev controller.
As it appears, it was really because "1.2v not enough to register as HIGH"
I am now feeding the cable through analog pin, and simply put an if-statement. It is probably not the best way to do it, but I figured I have 8 precious analog pins on my Nano, why not splurge it on 3 simple on-off reader
char ReadMode()
{
char CurrentMode = 'D'; // Reset
int ModeR_raw = analogRead(ModeR_pin);
int ModeE_raw = analogRead(ModeE_pin);
int ModeB_raw = analogRead(ModeB_pin);
int ModeN_raw = analogRead(Throttle_pin);
if (ModeR_raw < 150){
CurrentMode = 'R';
} else if (ModeE_raw < 150){
CurrentMode = 'E';
}
if (ModeB< 150){ // Boost switch will override other modes
CurrentMode = 'B';
}
if (ModeN < (ThrottleGain - 50)){ // No signal on throttle means Neutral
CurrentMode = 'N'; // Neutral override all
}
return CurrentMode;
}
Hi,
Can you post an updated circuit diagram, labelling Mode E B and R pins?
What are you using as your voltage regulator?
Do you have a fuse in the 120V circuit to protect your project?