Digital Tachometer for Harley Davidson Sportster (Part 7 - Components)21 Nov 2016 - 0 Comments
In this part I will list the components and integrated circuits (IC) I have used. Below, there is a basic circuit diagram (full schematic will be detailed in the next part).
The PIC18F2553 is the project brain. I would lie to you if I say that I chose this particular brand and model because it was the best of the best (best performance, best price, …). Frankly speaking, I chose it because it was the MCU family I started to work with when I decided to learn electronics. That and because it had enough pins to carry out this project.
Requirements and specifications:
- Processing speed: According the datasheet, this PIC can run up to 48MHz. For this application, 20MHz will be enough.
- TO: functions related to the messages emission and reception.
- T1: main code timer.
- T2: brightness intensity regulation by means of PWM.
- T3: function used to broadcast the information to the 7-segment driver. - I/O: needed for the switch button, transistors and signals to the 7-segment display.
- Interruptions: we will need one in order to stop temporarily the infinite loop and read the incoming J1850 bus message.
- Timers: there are 4 timers available and they will be used as following.
- PWM: adjustment of the 7-segment display brightness by means of PWM control.
- USART: In case we need the capability of designing a datalogger.
Furthermore, we will need:
- In-Circuit Debugger/Programmer: this means a specífic programmer for PICs. In this project I used the PICkit 2 and PICkit 3, from the same Microchip Technology company. These tools are connected between the computer (via USB) and your IC (via 3 pins; PGC, PGD i MCLR) and they allow you to program the PIC with the code you have compiled previously.
- MPLAB it is an IDE (Integrated Development Environtment) for PICs. It allows us to edit and compile code that we will program on the PIC afterwards with the PICkit.
If the PIC is the brain of the project, the MM5450 is the heart. This IC will allow us to control lots of pins in a very easy way. As a quick fact, according its website, by 2015 Microchip bought Micrel.
- Brightness Control: This IC has 1 pin (#19) that allows us to regulate the brightness of all the pins. With a PWM signal from the PIC and a resistor, we will be able to regulate the brightness by changing the PWM DC (Duty cycle).
- Serial Data input: All the 34 input pins from this LED driver are controlled by 2 pins; a clock signal (CLK) and a Data signal (DATA).
- 34 pins: Following diagram will show you how pins will be used on the MM5450. The alternative would be to multiplex the 7-Segments, this would allow me to use only 12 instead of 29, but for reasons I will explain on Part 15 (Issues during development) I decided to go for this configuration.
No doubt, for me, this 5V Fixed Voltage Regulator from Texas Instruments (TI) offers the best solution in IC format in order to have a simple and reliable power supply.
- It can supply up to 1A on the output. It has to be combined with a heat sink.
- Overtemperature protection.
- Shortcircuit protection.
In order to be able to read the J1850 bus messages, first we need to adapt the voltage levels between the bus and the PIC. There are some IC such as theMC33990 (NXP Feescale Semiconductor) or the HIP7020 (HARRIS Semiconductor), but as it is a very old technology, these ICs are discontinued and finding them on second hand markets it is no easy task.
Nevertheless, currently I am using the MC33990 in order to send some fake RPM and gear messages through a J1850 bus and receiving them by one of my working prototypes. Thanks to this, I am able to improve the software/code with no need to physically connect it to the motorcycle.
The alternative on these circuits is to use transistors and resistors in order to adapt the voltage levels between the bus and the PIC. As, for the moment, we will need only to read, the final circuit will be very simple as you can see in the image below. One intersting thing to see is how the voltage values are changing on the circuit and how they are finally inverted at the end. If you want to use the MC33990, you will need to change 2 things in the code; invert the input value on the PIC by means of a “!” and the most important, to change the kind of interruption selecting the rising edge interruption.