contador de kilómetros y revoluciones.pdf

10
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 por hora, 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, resolución de 0,5 grados. Voltímetro: visualiza la tensión de la batería o de otra fuente, desde 0 a 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. Cronómetro: muestra el tiempo de las 4 últimas vueltas en minutos, segúndos y décimas de segundo. Salida de datos: puede enviar los datos a un PC por medio de un cable conectado al puerto serie o por medio de un pequeño emisor. El muestreo de los datos se hace cada medio segundo. Funcionamiento: El PIC18F1320 recibe por el pin 18 los impulsos del sensor de revoluciones y por el 8 los del sensor de velocidad, mide el tiempo que pasa entre cada 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.

Upload: dorifutos-pez-3998

Post on 30-Oct-2014

63 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Contador de kilómetros y revoluciones.pdf

Contador de kilómetros y revolucionesCaracterí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 por hora, 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, resolución de 0,5 grados. Voltímetro: visualiza la tensión de la batería o de otra fuente, desde 0 a 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. Cronómetro: muestra el tiempo de las 4 últimas vueltas en minutos, segúndos y

décimas de segundo. Salida de datos: puede enviar los datos a un PC por medio de un cable conectado

al puerto serie o por medio de un pequeño emisor.

El muestreo de los datos se hace cada medio segundo.

Funcionamiento: El PIC18F1320 recibe por el pin 18 los impulsos del sensor derevoluciones y por el 8 los del sensor de velocidad, mide el tiempo que pasa entre cadaimpulso y a partir de este tiempo calcula las revoluciones por minuto y la velocidad enKms/hora. Para hacer estos cálculos tendremos que haber configurado antes el númerode impulsos que se producen por cada revolución del motor y también la medida enmilímetros de la circunferencia de las ruedas.

Page 2: Contador de kilómetros y revoluciones.pdf

Las resistencias R12, R13 y R14 forman un divisor de tensión que sirve para medir latensión de la batería, esta tensión se mide antes del diodo D1 que sirve de proteccióncontra inversiones de tensión, para evitar la caida de 0,6V que este produce. El rango detensión que se puede medir es de 0 a 25 voltios y la resolución que nos muestra es de0,1 voltios.

A la patilla 2 del PIC se conectan los sensores de temperatura, la resistencia R6 hace depull-up y R5 y D2 sirven para proteger la entrada del PIC. Lossensores usados son los DS18B20 de Dallas, cada uno tiene unadirección única por lo que se pueden poner en paralelo los 4 que

admite el circuito, tienen un rango de temperaturas de -55 a +125 grados, tienen unaresolución de 0,5 grados y la precisión es también de +/- 0,5 grados. Estos sensores sepueden usar en el modo de 'Parasite Power', lo que nos permite poderlos conectar consolo 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 dispositivo enalgunos 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ónpodemos hacer que salgan en modo RS232 o codificados en modo Manchester paraenviarlos 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 puertoserie del PC.

En el pin 17 se dejado una entrada para activar el cronómetro implementado en elmicrocontrolador, este empezará a contar en cuanto reciba un impulso, al siguienteimpulso almacenará el valor contado y otra vez empezará a contar desde cero y asísucesivamente, esto se ha hecho con la idea de cronometrar las vueltas a la pista en unkart por ejemplo. Los tiempos de las últimas 4 vueltas quedan almacenados en lamemoria y en el LCD podemos ver los tiempos contados en minutos, segundos ydécimas de segundo.

La resistencia RV1 sirve para ajustar el contraste del LCD y R22 para alimentar laretroiluminación de este. A la derecha en el esquema están los pulsadores de selecciónde los datos a visualizar.

Se han puesto dos estabilizadores de tensión en el circuito: un 78L05(IC2) y un7805(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 labatería y además permite grabar los kilómetros totales en la memoria eeprom del microcuando se corta la tensión de alimentación. El 7805 alimenta el resto de circuitosexcepto el microcontrolador.

El conector J7 sirve para conectar un visualizador con 3 displays de 7 segmentos en losque se muestran las RPM y otros 3 en los que se muestra la velocidad.

Conexiones:

Page 3: Contador de kilómetros y revoluciones.pdf

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.

SchematicThe circuit is loosely based on one I found on the web a number of years ago, although Ihave made a number of significant changes to it.

The schematic for the speedo is shown below.

Page 4: Contador de kilómetros y revoluciones.pdf

digital speedo schematic(click for larger version)

The schematic was originally drawn Circad for DOS. I've since used the evaluationversion 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 schematic format (52KB) speedo.pdf - PDF format (47KB) speedo.png - PNG image format (27KB)

Circuit DescriptionIC1 (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 theCLK input on IC5 (4553 CMOS 3-digit BCD counter).

IC2, a 555 timer configured as an astable multivibrator, and IC3 (4017 CMOS decadecounter) provide the timebase circuitry to control IC5, the 4553 CMOS 3-digit BCDcounter.VR1 and VR2 allow the frequency of the timebase circuit to be adjusted, thus allowingthe entire circuit to be calibrated.

The outputs of IC3 provide the reset, latch and gating signals for IC5, the 4553 CMOS3-digit BCD counter. The first 8 outputs of IC3 (Q0 - Q7) gate the 4553 counter (IC5)for the first eight clock cycles.

The input circuitry clocks the 4553 counter (IC5), and IC3's ninth clock pulse (outputQ8) stops IC5 from counting by triggering the latch enable input of IC5, and alsotransfers 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 asingle 4511 seven-segment decoder/driver (IC6), by multiplexing them (ie, togglingeach display individually via its cathode at a fast rate, so the multiplexing is not visibleto the human eye).

Page 5: Contador de kilómetros y revoluciones.pdf

IC5 has three internal BCD counters, and it cycles through each of these counters, usingoutputs DS1-3 to turn on each display, while at the same time, the appropriate digit isdisplayed 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 providedimming of the output displays when the car headlights are turned on. This is achievedby using an oscillator to drive the blanking input of IC5 with a lower duty cycle whenthe headlights are on. This ensures the speedo display is visible during the day, and isn'ttoo bright at night.

Component ListResistors(all 1/4W 5% unless otherwise specified)R1 10ohm 1WR2 5.6kohmR3 1kohmR4 56kohmR5 10kohmR6 100kohmR7 47kohmR8 56kohmR9 10kohmR10-11 100kohmR12 4.7kohmR13-19 68ohmR20-22 2.2kohmVR1 100Kohm variable trimpotVR2 25Kohm variable trimpot

CapacitorsC1 100uF 25v electrolyticC2 1000uF 16VC3 10uF 25v electrolyticC4-5 0.1uF ceramicC5 1nF ceramicC6 10nF ceramicC7 1uF low leakage RBLL electrolyticC8-9 10nF ceramicC10 1nF ceramic

SemiconductorsD1 1N4001 1A diodeD2-D19 1N914 signal diodeZD1 15V 1W zenor diodeQ1 BC549 NPN transistorQ2-4 BC559 PNP transistorIC1 MC7808T 8 volt regulatorIC2 555 timer

Page 6: Contador de kilómetros y revoluciones.pdf

IC3 4017 CMOS decade counterIC4 74C14 hex schmitt trigger invertorIC5 4553 CMOS 3-digit BCD counterIC6 4511 seven-segment decoder/driver

Other3-digit 7-segment display (common cathode)2 magnetssensor coil

Note that while I used a single 3-digit 7-segment display, you can use three individualsingle-digit 7-segment displays. You'll just need to connect the annodes of each 7-segment display in parallel.

Construction DetailsI constructed a PCB for the power regulation and input circuitry, and used some lengthsof 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 circuitry, so it stayed on abreadboard for 5 years in my car.The PCB and breadboard are connected via a 7-core data cable.

Page 7: Contador de kilómetros y revoluciones.pdf

the complete circuit, with output circuitry on the breadboard

The bundle of wires exiting the top left of the breadboard go to the display unit, and thewires exiting the top right of the PCB provide power and sensor input into the circuit.

The PCB and breadboard were installed under the centre console in my Datsun, with theoutput display located in my line-of-sight, on top of the dash.

Output DisplayThe output display was constructed using a 4-digit 7-segment display salvaged from anelectronic alarm clock, with 16mm high digits. Note that any 7-segment displays can beused, but I chose to use the alarm clock display, as it provided a single integrated unitfor the output display, and I had it in my junk box already.

speedo display

A small shade visor was constructed out of thin card, and the inside was painted black.This kept the direct sun off the display, ensuring the display was legible even in brightsunlight.

Page 8: Contador de kilómetros y revoluciones.pdf

installed on top of the dash

The speedo display is visible in the top right of the above photo, shown installed on topof the dash in my Datsun 1200.

SensorI attached two strong magnets to the tailshaft, just behind the gearbox. Having themagnet and sensor closer to the rear of the car could have resulted in an erratic signalpickup, as there is more up/down movement of the tailshaft relative to the chassistowards 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 twomagnets were used, located on oposite sites of the tailshaft.

A coil, sourced from a solenoid from some electro-mechanical device (I can't recall, butpossibly from an electronic typewriter) was used to create the sensor.The coil was screwed to a section of aluminium plate, to provide an easy method formounting it underneath the car, and coated with silicone, to provide some protectionfrom harsh environment underneath a car.

installed on top of the dash

The speedo display is visible in the top right of the above photo, shown installed on topof the dash in my Datsun 1200.

SensorI attached two strong magnets to the tailshaft, just behind the gearbox. Having themagnet and sensor closer to the rear of the car could have resulted in an erratic signalpickup, as there is more up/down movement of the tailshaft relative to the chassistowards 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 twomagnets were used, located on oposite sites of the tailshaft.

A coil, sourced from a solenoid from some electro-mechanical device (I can't recall, butpossibly from an electronic typewriter) was used to create the sensor.The coil was screwed to a section of aluminium plate, to provide an easy method formounting it underneath the car, and coated with silicone, to provide some protectionfrom harsh environment underneath a car.

installed on top of the dash

The speedo display is visible in the top right of the above photo, shown installed on topof the dash in my Datsun 1200.

SensorI attached two strong magnets to the tailshaft, just behind the gearbox. Having themagnet and sensor closer to the rear of the car could have resulted in an erratic signalpickup, as there is more up/down movement of the tailshaft relative to the chassistowards 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 twomagnets were used, located on oposite sites of the tailshaft.

A coil, sourced from a solenoid from some electro-mechanical device (I can't recall, butpossibly from an electronic typewriter) was used to create the sensor.The coil was screwed to a section of aluminium plate, to provide an easy method formounting it underneath the car, and coated with silicone, to provide some protectionfrom harsh environment underneath a car.

Page 9: Contador de kilómetros y revoluciones.pdf

the sensor coil

The aluminium plate was then screwed to the underbody of my car, with the coil beingmounted about 10-15mm away from the magnets on the tailshaft. If using weakermagnets, or a smaller coil, you'll need to locate the coil closer to the tailshaft.

Due to the rotational speed of the tailshaft, the centrifical forces on the magnets arequite high.Several methods for attaching the magnets to the tailshaft were attempted, with mostresulting in one or both magnets coming lose, and being hurled violently against theunderside of the tailshaft tunnel, typically when driving at a reasonable speed.

Some magnets were gluded to the tailshaft using liquid nails, but had to 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 to hold the magnets in place for a few days while the gluedried. The hose clamp was then replaced with a few cable ties, as the metal hose clampwould have affected the operation of the sensor.

CalibrationThe circuit was calibrated by feeding a low voltage 50Hz AC signal into the sensorinput, and then adjusting VR1 and VR2 until the speedo reading was correct.

calibration circuit

To determine the correct speedo reading with an input signal of 50Hz, you'll need tomeasure the circumference of one of the rear wheels, and also determine the diff ratioe.As two magnets are normally used to provide the input pulses, resulting in two pulsesper rotation, a 50Hz input signal is equivalent to a 25Hz tailshaft rotation. The desiredoutput reading can then be calculated, using the rear wheel circumference, and the diffratio.

The desired speedo display can be calculated in km/h using as follows:

Page 10: Contador de kilómetros y revoluciones.pdf

speed in km/h = (wheel circumference in km) x (tailshaft rotations per hour)diff ratio

The rolling circumference of the rear tyres on my Datsun 1200 (205/60R14 tyres) wasmeasured as being 1827mm, and the diff ratio is 3.9.

This results in:

speed in km/h = (1827x10-6) x (25Hz x 3600) = 42.16 km/h3.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 variationsfrom this shouldn't affect the accuracy of the speedo much at all.

References

Martin's Datsun 1200 4553 3-Digit BCD Counter 4511 BCD-to-7 Segment Latch/Decoder 4017 Decade Counter