Contador de kilómetros y revoluciones Características:
Cuentakilómetros: mide los kilómetros totales y parciales. Tacómetro: muestra las revoluciones del motor., desde 10 hasta >30.000. Velocímetro: muestra la velocidad en kilómetros kilómetros por hora, desde desde 1 a aprox. 800, también puede mostrar la velocidad media y máxima. Termómetro: visualiza la temperatura de hasta 5 sensores en un rango de temperaturas desde -50 a 125 grados, grados, resolución de 0,5 grados. grados. Voltímetro: visualiza la tensión de la batería batería o de otra fuente, desde 0 a 25 25 voltios con resolución de 0,1. Tiempo de viaje: muestra el tiempo que ha pasado desde que se puso en marcha. Visualización: los datos se visualizan en un display LCD de 2 filas de 16 carácteres, tiene salida adicional para displays de 7 segmentos. segmentos. Cronómetro: muestra el tiempo de las 4 últimas vueltas en minutos, segúndos y décimas de segundo. Salida de datos: puede datos: puede enviar los datos datos a un PC por medio medio de un cable cable conectado al puerto serie o por medio de un pequeño emisor.
El muestreo de de los datos se hace hace cada medio segundo. segundo.
PIC18F1320 recibe por el pin 18 los impulsos del sensor de Funcionamiento: El PIC18F1320 revoluciones y por el 8 los del sensor de velocidad, mide el tiempo que pasa entre cada c ada impulso y a partir de este tiempo calcula las revoluciones por minuto y la velocidad en Kms/hora. Para hacer estos cálculos tendremos que haber configurado antes el número de impulsos que se producen por cada revolución del motor y también la medida en milímetros de la circunferencia de las ruedas.
Las resistencias R12, R13 y R14 forman un divisor de tensión que sirve para medir la tensión de la batería, esta tensión se mide antes del diodo D1 que sirve de protección contra inversiones de tensión, para evitar la caida de 0,6V que este produce. El rango de tensión que se puede medir es de 0 a 25 voltios y la resolución res olución que nos muestra es de 0,1 voltios. A la patilla 2 del PIC se conectan los sensores de temperatura, la resistencia R6 hace de pull-up y R5 y D2 sirven para proteger proteger la entrada del PIC. Los sensores usados son los DS18B20 DS18B20 de Dallas, cada uno uno tiene una dirección única por lo que se pueden poner en paralelo los 4 que admite el circuito, tienen un rango de temperaturas temperaturas de -55 a +125 grados, grados, tienen una resolución de 0,5 0,5 grados y la precisión es también también de +/- 0,5 grados. Estos sensores se pueden usar en el modo de 'Parasite Power', lo que nos permite poderlos poderlos conectar con solo dos hilos, para ello tenemos que unir a masa los pines 1 y 3 del sensor. En el conector J4 se ha dejado una salida para poder activar algún al gún dispositivo en algunos casos concretos, esto aún no se ha implementado en el software. La salida de datos se hace por el pin 9 a través del transistor T1, en la configuración podemos hacer que que salgan en modo RS232 o codificados codificados en modo Manchester Manchester para enviarlos a través de un pequeño módulo emisor de los usados en mandos a distancia, en este caso necesitariamos un módulo receptor y decodificador conectado al puerto serie del PC. En el pin 17 se dejado una entrada para activar el cronómetro implementado en el microcontrolador, este empezará a contar en cuanto reciba un impulso, al siguiente impulso almacenará el valor contado y otra vez empezará a contar desde cero y así sucesivamente, esto se ha hecho hecho con la idea de cronometrar cronometrar las vueltas a la pista en un kart por ejemplo. Los tiempos de las últimas 4 vueltas quedan almacenados en la memoria y en el LCD podemos ver los tiempos contados en minutos, segundos y décimas de segundo. se gundo. La resistencia RV1 sirve para ajustar el contraste del LCD y R22 para alimentar la retroiluminación de este. A la derecha en el esquema están los pulsadores de selección de los datos a visualizar. Se han puesto dos estabilizadores de tensión en el circuito: un 78L05(IC2) y un 7805(IC3), el primero alimenta el microcontrolador y lleva un condensador "goldcap" de 0,047uF en la salida que mantiene la tensión ante fluctuaciones de la tensión de la batería y además permite grabar grabar los kilómetros totales en la memoria memoria eeprom del micro cuando se corta la tensión de alimentación. El 7805 alimenta el resto de circuitos excepto el microcontrolador. El conector J7 sirve para conectar un visualizador con 3 displays de 7 segmentos en los que se muestran las RPM RPM y otros 3 en los que se muestra la velocidad. velocidad.
Conexiones:
J1 : Alimentación de 8 a 25 voltios. J2 : Conexión de los sensores de temperatura. J3 : Entrada de señal de los sensores de revoluciones y de velocidad. J4 : Salida de alarma(no usada de momento). J5 : Salida de los datos al PC. J6 : Entrada de activación del cronómetro. J7 : Conexión de un visualizador con displays de 7 segmentos.
Ejemplo de visualización de la velocidad, las R.P.M. , los kms totales y los parciales.
Schematic The circuit is loosely based on one I found on the web a number of years ago, although I have made a number of significant changes to it. The schematic for the speedo is shown below.
digital speedo schematic (click for larger version) The schematic was originally drawn Circad Circad for DOS. I've since used used the evaluation version of Circad'98 of Circad'98 for Windows to generate a PDF version of it. The schematic is available for download in the following formats:
speedo.sch - Circad 4.0 4.0 schematic schematic format (52KB) (52KB) speedo.pdf -- PDF format (47KB) speedo.pdf (47KB) speedo.png - PNG image image format format (27KB) (27KB)
Circuit Description IC1 (7808 voltage regulator) and associated capacitors and diodes provides a regulated +8v power rail required by the rest of the circuit. Q1 and a resistor network, along with IC4b (one of the hex schmitt trigger invertors), function as the input circuitry, driven by the sensor coil. This circuitry and toggles the CLK input on IC5 (4553 CMOS 3-digit BCD counter). IC2, a 555 timer configured as an astable multivibrator, and IC3 (4017 CMOS decade counter) provide the timebase circuitry to control IC5, the 4553 CMOS 3-digit BCD counter. VR1 and VR2 allow the frequency of the timebase circuit to be adjusted, thus allowing the entire circuit to be calibrated. The outputs of IC3 provide the reset, latch and gating signals for IC5, the 4553 CMOS 3-digit BCD BCD counter. The The first 8 outputs outputs of IC3 IC3 (Q0 - Q7) gate the 4553 counter counter (IC5) for the first first eight eight clock cycles. cycles. The input circuitry clocks the 4553 counter (IC5), and IC3's ninth clock pulse (output Q8) stops IC5 from counting by triggering the latch enable input of IC5, and also transfers the counter value to the outputs of IC5. The tenth clock pulse (output Q9) resets IC5, thus starting a new count sequence. The 4553 CMOS 3-digit BCD counter (IC5) drives all three 7-segment displays using a single 4511 seven-segment decoder/driver (IC6), by multiplexing them (ie, toggling each display individually via its cathode at a fast rate, so the multiplexing is not visible to the human eye).
IC5 has three internal BCD counters, and it c ycles through each of these counters, using outputs DS1-3 to turn on each display, while at the same time, the appropriate digit is displayed on the corresponding 7-segment display. D15-19 and IC4f dim the leading digit if it is zero by pulling the cathode high. IC4d (one of the hex schmitt trigger invertors) and a few resistors and diodes provide dimming of the output displays when the car headlights are turned on. This is achieved by using an an oscillator to drive the blanking blanking input of IC5 IC5 with a lower duty duty cycle when the headlights are on. This ensures the speedo display is visible during the day, and isn't too brigh brightt at night. night. Component List Resistors (all 1/4W 5% unless otherwise specified) R1 10ohm 1W R2 5.6kohm R3 1kohm R4 56kohm R5 10kohm R6 100kohm R7 47kohm R8 56kohm R9 10kohm R10-11 100kohm R12 4.7kohm R13-19 68ohm R20-22 2.2kohm VR1 100Kohm variable trimpot VR2 25Kohm variable trimpot Capacitors C1 100uF 25v electrolytic C2 1000uF 16V C3 10uF 25v electrolytic C4-5 0.1uF ceramic C5 1nF ceramic C6 10nF ceramic C7 1uF low leakage RBLL electrolytic C8-9 10nF ceramic C10 1nF ceramic Semiconductors D1 1N4001 1A diode D2-D19 1N914 signal diode ZD1 15V 1W zenor diode Q1 BC549 NPN transistor Q2-4 BC559 PNP transistor IC1 MC7808T 8 volt regulator IC2 555 timer
IC3 4017 CMOS decade counter IC4 74C14 hex schmitt trigger invertor IC5 4553 CMOS 3-digit BCD counter IC6 4511 seven-segment decoder/driver Other 3-digit 7-segment display (common cathode) 2 magnets sensor coil
Note that while I used used a single 3-digit 7-segment 7-segment display, you can use three individual single-digit 7-segment 7-segment displays. You'll just need need to connect the annodes annodes of each 7segment display in parallel. Construction Details I constructed a PCB for the power regulation and input circuitr y, and used some lengths of multi-core data cable to connect to the output display.
the PCB containing input and power circuitry I never got around to making a PCB for the output circuitr y, so it stayed on a breadboard for 5 years in my car. The PCB and breadboard are connected via a 7-core data cable.
the complete circuit, with output circuitry on the breadboard The bundle of wires exiting the top left of the t he breadboard go to the display unit, and the wires exiting the top right of the PCB provide power and sensor input into the circuit. The PCB and and breadboard were installed under under the centre console in my Datsun, with the output display located in my line-of-sight, on top of the dash. Output Display The output display was constructed using a 4-digit 7-segment display salvaged from an electronic alarm clock, with 16mm high digits. Note that any 7-segment displays can be used, but I chose to use the alarm clock display, as it provided a single integrated unit for the output display, and I had it in my junk box already.
speedo display A small shade visor was constructed out of thin t hin card, and the inside was painted black. This kept the direct sun off the display, ensuring the display was legible even in bright sunlight.
installed on top of the dash The speedo display is visible in the top right of the above photo, shown installed on top of the dash in my Datsun 1 00. Sensor I attached two strong magnets to the tailshaft, just j ust behind the gearbox. aving the magnet and sensor closer t the rear of the car could have resulted in an erratic signal pickup, as there is more more up down movement of the tailshaft relative to t e chassis towards the rear of the car, as a result of the rear suspension movement.
mounting and location of the sensor coil relative to the tailshaft Using just a single magnet would have resulted in an unbalanced tailshaft, so two magnets were used, locate on oposite sites of the tailshaft. A coil, sourced from a sole noid noid from some electro-mechanical device (I can't recall, but possibly from an an electronic typewriter) was used to create the sensor. The coil was screwed to a ection of aluminium plate, to provide an eas method for mounting it underneath the car, and coated with silicone, to provide so e protection from harsh environment un derneath a car.
the sensor coil The aluminium plate was then screwed to the underbody of my car, with t he coil being mounted about 10-15mm 10-15mm away from the magnets on the tailshaft. t ailshaft. If using weaker magnets, or a smaller coil, you'll need to locate the coil closer to the tailshaft. Due to the rotational speed of the tailshaft, tails haft, the centrifical forces on the magnets are quite high. Several methods for attaching the magnets to the tailshaft were attempted, with most resulting in one or both magnets coming lose, and being hurled violently against the underside of the tailshaft tunnel, typically when driving at a reasonable speed. Some magnets were gluded to the tailshaft using liquid nails, but had t o be chiselled off, as they weren't powerful enough to trigger the sensor. Eventually, I glued some powerful magnets to the tailshaft using super-strength araldite. I used a metal hose clamp clam p to hold the magnets in place for a few days while the glue dried. The hose clamp was then replaced with a few cable ties, as the metal hose clamp would have affected the operation of the sensor. Calibration The circuit was calibrated by feeding a low l ow voltage 50Hz AC signal into the sensor input, and then adjusting VR1 and VR2 until the speedo reading was correct.
calibration circuit To determine the correct speedo reading with with an input signal of 50Hz, you'll need to measure the circumference of one of the rear r ear wheels, and also determine the diff ratioe. As two magnets are normally used to provide the input pulses, resulting in two pulses per rotation, a 50Hz 50Hz input signal is equivalent equivalent to a 25Hz tailshaft rotation. The The desired output reading can then be calculated, using the rear wheel circumference, and the diff ratio. The desired speedo display can be calculated in km/h using as follows:
speed speed in km/h km/h =
(wheel circumference in km) x (tailshaft (tail shaft rotations per hour) diff ratio
The rolling circumference of the rear t yres on my Datsun 1200 (205/60R14 (205/60R14 tyres) was measured as being 1827mm, and the diff ratio is 3.9. This results in: (1827x10 -6) x (25Hz x 3600) speed speed in km/h km/h = = 42.16 km/h 3.9 so VR1 and VR2 were adjusted until the speedo output was 42 km/h. Note that this method assumes the local AC is very close to 50Hz, but small variations variations from this shouldn't affect the accuracy of the t he speedo much at all. References
Martin's Datsun 1200 4553 3-Digit BCD Counter 4511 BCD-to-7 Segment Latch/Decoder 4017 Decade Counter