This Article is to make readers to explore about how Speedometer works in modern cars. Here you can get an idea on the CAN Bus which is used in the Communication of Sensors, Actuators and controllers in a car.
Controller Area Network or CAN protocol is a methodology of communication between various electronic devices like engine management systems, gear control, active suspension, ABS, airbags, lighting control, air conditioning, central locking etc. embedded in an automobile. For further learnings refer this article.
Description:Prerequisites & Equipment:You are going to need the following:
- Two Arduino Board or Arduino clone(Here is a guide if you need)
- A 5v TTL -UART Bluetooth module.
- LCD, Proximity Sensor, DC Motor and Servo Motor.
- Arduino IDE for the programming.
- Two CAN Tranciever.
Here to simulate the engine RPM measurement, we are using Industrial proximity sensor used to measure the speed of rotating objects and a DC motor which is speed controlled by the Preset.
Inductive Proximity Sensor:For non-contact detection of metallic targets at ranges less than 50mm (2 inches) Inductive Proximity sensors are mostly used. These sensors have sensing area where an alternating electro-magnetic field is emitted, when a metal target enters the sensing area, eddy currents are induced in the target, which results in a change of state at the sensor output.
Here the output of the sensor will be high when a metal is placed near the sensing area and vice versa. Using this we can make an arrangement that gives only one high pulse for each rotation of the motor. Counting pulses for one minute can give the Rotations per Minute.
Speed Measurement:This project uses an Inductive Proximity sensor to detect the presence of a metal. Whenever a metal comes near the sensor, it can detect it. Hence, this sort of sensor can be used to do a lot of things. For example, if we need to detect when a door is close, then we can attach a metal to the door and the sensor to the frame of the door. Whenever the door closes, the metal gets placed near the sensor and therefore we are able to detect that the door is closed.
This same principle can be used to make a speedometer for a bike or any other vehicle in a non-contact way by attaching a metal to the wheel and a sensor is placed somewhere in the frame of the bike, the time taken for one revolution can be measured by counting the time interval between the two detections.
The setup is made as follows, a screw is connected to the rotating part of the motor and it is projected to small distance. The motor is powered by 12V power supply.
The signal goes high when the screw is near to the sensor placed near the motor.
The numbers...
RPM = 60000000/timerrevCalc;
Where:
60 = seconds in a minute.
Duration = amount of time sensing area exposed to metal in uS.
1.4574 = the metal notch is 1.4574 times smaller than the remainder of the wheel, this number needs to be calculated and adjusted per application.
60000000 is a conversion from uS to just plain seconds.
This appears to be VERY fast at reading RPM. The RPM is calculated with EACH pulse. So instead of using an interrupt and have to wait the interrupt interval to refresh the data, the data come in after each pulse is timed. Also, when using interrupts, you have limited resolution. Example, 1 pulse counted over 250ms so 4 pulses per second or 240 RPM and 2 pulses per 250ms so 8 pulses per second or 480 RPM!!! 1 pulse increase will lead to 240RPM increase. To get better resolution, you need a longer interrupt interval. But, At the same time longer interrupt interval will lead to slower response.
Connections for the Arduino and Sensor in TX Side:The sensor used here has three wires where, Red and black is VCC and GND and Green wire is the Digital output of the sensor. As stated previously output will go high when metal is near the sensing area.
The VCC of the sensor is connected to 5V. The GND of the sensor is connected to the GND pin of the Arduino. And the Vout or Digital output of the sensor is connected to Arduino’s interrupt pin (pin 2).
Running the Program:Load the program TX.ino after you save it onto your computer and open it in Arduino IDE.
- Compile the program in the Arduino IDE
The following function is used to send the values to the CAN bus. Detailed instruction can be found here.
CAN.sendMsgBuf(0x70, 0, 2, stmp);
Receiving CAN Data and Displaying on an LCD in RX Side:Load the program RX.ino after you save it onto your computer and open it in Arduino IDE.
- Compile the program in the Arduino IDE
The following function is used to receive the values from the CAN bus and to display in an LCD. Detailed instruction can be found here.
CAN.readMsgBuf(&len, buf);
Loading Software for Arduino:If you are new to Arduino you can start with here. You have to start with the Arduino IDE (Integrated Development Environment) from ]]>Arduino]]> . Download the code from below link and upload it to the Arduino board.
The operation of the system is as follows:
- The DISPLAY processor that waits for the current RPM message send from the COLLECTOR processor over the CAN bus.
- The COLLECTOR processor measure the RPM, formats it, and sends to the DISPLAY processor over the CAN bus.
- The DISPLAY processor reads the message from the CAN bus and then displays it on the LCD which is repeated.Hardware assembly:
Make the circuit as is given by the circuit diagram. Make the circuit with your selected parts and connect the motors to the circuit.
.
Comments