good evening everyone, I found the solution that I will now share with all of you for free, without dealing with those fake bikers who are online who ask you for 200€ for this project (ridiculous, beggars, and all the worst that can be said to them).
(sorry for the outburst but I am really pissed off with these people who take advantage of people who don't know)
STEP 1 - (locate the gear sensor connector)
the gear sensor is white and triangular in shape (see photo), it is positioned under the tank.
There are 3 wires:
Now you can choose what to do:
- use power stealers
- or cut the wires and solder a 3rd wire
I preferred to use current thieves, since we are talking about really low voltages (maximum 5v).
STEP 2 - (A little theory first)
premise:
online and also in this forum (which is particularly dated) you can ONLY find information regarding the use of resistance comparators, which in my opinion is an obsolete technology, old and really NOT easy to understand for everyone. So my project will not only be easy to understand, but it will be a plug & play, the only thing you will need is some electronic components, a soldering iron, some tin, and at least 2 meters of cable.
explanation:
what we are going to do is simply use a microprocessor that will detect the voltage of each gear, below I leave you the voltages that I found:
1st - 1.7 / 1.8v
N - 4.7 / 4.9v
2nd - 2.2 / 2.3v
3rd - 2.9 / 3.0v
4th - 3.5 / 3.7v
5th - 4.1 / 4.2v
6th - 4.4 / 4.6v
once we have found the voltages we will already be halfway there, because the rest will be very easy, I will just have to teach the processor to detect this voltage and to turn on the red LEDs behind the speedometer based on what it has measured. I will explain it to you in a simpler way.... do you know what a tester is? a multimeter? a voltmeter?
here we are going to create exactly this, and we will teach it to a microprocessor (don't worry now I will tell you everything), once we have taught the processor to measure the voltages, we will use the measurement values as confirmation to turn on the LEDs.
STEP 3 - (Microprocessor)
rightly many of you will be wondering what this microprocessor I'm talking about is, and maybe those who are more educated in electronics will have already understood...
exactly, him.. ARDUINO
in fact what we are going to do is to use Arduino in "voltage meter" configuration and then "comparator", to make it short we will use Arduino as a voltmeter and then we will tell it to check if the voltage it measures is equal to the one we want (i.e. the voltages I wrote above).
Now you're probably wondering where to connect Arduino, how to connect it, etc... wait a minute, I'll explain..
STEP 4 - (Project explanation)
here we are at the juicy part, how and what we have to do...
first of all we have to get the essentials for the project, so:
- Arduino
- resistors (100ohm x6 / 10kohm x2)
- led smd (of the color you want)
- cables
- screwdrivers, Allen keys, etc...
ok, now that we have the essentials, we must first create 2 things:
- the connection for reading the voltages
- find the 5v power supply for arduino
1st photo: 2 wire connection for voltage detection (I used the current thief), the wires you will have to use are ONLY the red and the black ones
2nd photo: under the tank find this connector, in the red wire pass +5v, I used a current thief here too
Once you have created some wire extensions using current thieves, both for the power supply and the gear sensor, you can now proceed with the programming logic.
Electrical diagram:
This photo is a test I did using only 3 LEDs, but don't worry the logic is the same for 6 LEDs (6 gears).
what we should do is connect 2 resistors in parallel to the analog input A0 of Arduino that we will use as the tips of a multimeter (voltmeter), and guess what we are going to measure? exactly, the voltage on the probe, so to those 2 resistors (10kohm) we will connect the 2 wires that you will have extended from the gear probe (red and black wire), by doing so Arduino will detect the input voltage.
but now we have to teach Arduino to turn on the lights on the dashboard based on the voltage that it measures from the probe....
Arduino Code:
C++:
const int analogPin = A0;
const int ledPin2 = 2;
const int ledPin3 = 3;
const int ledPin4 = 4;
const int ledPin5 = 5;
const int ledPin6 = 6;
const int ledPin7 = 7;
const int ledPin8 = 8;
float vout = 0.0;
float vin = 0.0;
float R1 = 10000;
float R2 = 10000;
int value = 0;
void setup() {
Serial.begin(9600);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
pinMode(ledPin4, OUTPUT);
pinMode(ledPin5, OUTPUT);
pinMode(ledPin6, OUTPUT);
pinMode(ledPin7, OUTPUT);
pinMode(ledPin8, OUTPUT);
}
void loop() {
value = analogRead(analogPin);
vout = (value * 5.0) / 1024.0;
vin = vout / (R2 / (R1 + R2));
Serial.print("Tensione misurata: ");
Serial.println(vin);
if (vin >= 1.5 && vin <= 1.9) {
digitalWrite(ledPin2, HIGH);
digitalWrite(ledPin3, LOW);
digitalWrite(ledPin4, LOW);
digitalWrite(ledPin5, LOW);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin7, LOW);
digitalWrite(ledPin8, LOW);
} else if (vin >= 4.65 && vin <= 5.0) {
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin3, HIGH);
digitalWrite(ledPin4, LOW);
digitalWrite(ledPin5, LOW);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin7, LOW);
digitalWrite(ledPin8, LOW);
} else if (vin >= 2.0 && vin <= 2.4) {
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin3, LOW);
digitalWrite(ledPin4, HIGH);
digitalWrite(ledPin5, LOW);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin7, LOW);
digitalWrite(ledPin8, LOW);
} else if (vin >= 2.8 && vin <= 3.1) {
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin3, LOW);
digitalWrite(ledPin4, LOW);
digitalWrite(ledPin5, HIGH);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin7, LOW);
digitalWrite(ledPin8, LOW);
} else if (vin >= 3.4 && vin <= 3.8) {
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin3, LOW);
digitalWrite(ledPin4, LOW);
digitalWrite(ledPin5, LOW);
digitalWrite(ledPin6, HIGH);
digitalWrite(ledPin7, LOW);
digitalWrite(ledPin8, LOW);
} else if (vin >= 4.0 && vin <= 4.3) {
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin3, LOW);
digitalWrite(ledPin4, LOW);
digitalWrite(ledPin5, LOW);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin7, HIGH);
digitalWrite(ledPin8, LOW);
} else if (vin >= 4.4 && vin <= 4.6) {
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin3, LOW);
digitalWrite(ledPin4, LOW);
digitalWrite(ledPin5, LOW);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin7, LOW);
digitalWrite(ledPin8, HIGH);
} else {
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin3, LOW);
digitalWrite(ledPin4, LOW);
digitalWrite(ledPin5, LOW);
digitalWrite(ledPin6, LOW);
digitalWrite(ledPin7, LOW);
digitalWrite(ledPin8, LOW);
}
delay(100);
}
you copy the code and put it on arduino (if you don't know how to do it maybe I'll make another tutorial) in any case once you have uploaded the program, connected arduino to the +5v of the motorbike and connected the probe (red and black wire) to arduino (via the 2 10k ohm resistors) you are already 75% done with the work.
LED behind the speedometer:
for the photos I'm taking the one taken by another user on this forum
the final result should be this (last photo), you will have to use a perforated board on which to solder the smd leds (of the color you want). I recommend connecting a resistor of at least 100ohm on the anode of the led (as I told you in the list above, 100ohm x6, or 1 resistor per led), while connecting the cathodes of each led together.
once you have closed the tachometer you will only have to bring the 7 wires from the tachometer to the arduino and you will be finished.
STEP 5 - (Conclusions)
so, the project as you can see is really simple, it requires a minimum of manual skills and basic knowledge of electronics, but it can be replicated by anyone. Now since I don't want to use the whole Arduino board I created a board on a millefori with Arduino alone and I put terminal blocks, resistors, etc... directly on the PCB, so I created something more elegant to look at, which is basically what I recommend you do, let's say that this guide is very theoretical, then in practice there are things that you can, indeed, MUST do, for example connecting the LED cables directly on Arduino is crazy, that's why I created the PCB with the terminal block, I leave you below the diagram of the PCB that I created
If you have any doubts or questions do not hesitate to ask 