Limpkin's blog - Tag - oled<div>An electronics geek blog, dedicated to sharing and open source. Check out my stores: <a href="https://lectronz.com/stores/stephanelec" hreflang="en" title="Lectronz store">EU</a> / <a href="https://www.tindie.com/stores/stephanelec" hreflang="en" title="tindie store">EU & US</a>.</div>2024-03-29T00:41:47+00:00Mathieuurn:md5:51de6a3d917257edeff5a252fe925b02DotclearThe Engine Control Unit monitor projecturn:md5:001af089278c72b8f9ba1915dbc608332011-01-11T20:34:00+00:002024-03-08T21:07:48+00:00limpkinMy Projectsavrecueepromlcdoled<p>It has been quite a long time since I last posted a project on this blog... for the good reason that I am going to detail here for you guys!<br>
So in this article you will see a quite complex project I have been working on for at least 6 months, which is an Engine Control Unit (ECU) monitor...<br><br>
<img src="https://www.limpkin.fr/public/.ECU_DIN_m.jpg" alt="The ECU monitor in DIN version" class="media-center" title="The ECU monitor in DIN version, janv. 2011"></p> <p>So... what is an Engine Control Unit (<a href="http://en.wikipedia.org/wiki/Engine_Control_Unit" hreflang="en">ECU</a>)?<br>
Well, basically the ECU is what controls your car. It is connected to sensors placed around your engine (air / engine coolant temperature, oil temperature, admission pressure, etc...) and outputs several signals such as the ones going to the ignition module, in charge of making the sparks inside your combustion engine :<br></p>
<p><a href="https://www.limpkin.fr/public/ECU_descript.GIF" title="What is an ECU"><img src="https://www.limpkin.fr/public/.ECU_descript_m.jpg" alt="What is an ECU" class="media-center" title="What is an ECU, janv. 2011"></a><br></p>
<p>Thus, by monitoring this ECU, you can have accurate readings about what is going on inside your car. The ECU monitor project I made here is meant to be used in previous generation cars, where all sensors and ECU outputs are <strong>analogic</strong>. Most recent cars currently use the <a href="http://en.wikipedia.org/wiki/Obd2#OBD-II" hreflang="en">OBD2</a> protocol usually implemented on a <a href="http://en.wikipedia.org/wiki/Controller_Area_Network" hreflang="en">CAN</a> bus. So why bother with previous generation cars? Well, firstly because it is easier to interface this project with them, and mostly because many owners of a specific car using this kind of ECU wanted an ECU monitor more up to date.<br>
So, as you may have understood by now, I am currently selling this project to some people in many countries! Sorry guys, I will thus not give you all of the source code (10k lines of code!) here but however will give you everything else!<br>
So... what do we want to measure that could be interesting?<br></p>
<p><ins>Analog voltages :</ins><br>
- The manifold absolute pressure (MAP), which is the absolute pressure (relative to a vacuum) of the air in the intake manifold of an internal combustion engine<br>
- The throttle position sensor (TPS), used to monitor the position of the throttle<br>
- The engine coolant temperature (ECT)<br>
- The air coolant temperature (ACT)<br>
- Oil temperature<br>
- Oil pressure<br>
- Battery voltage<br>
- Exaust gaz temperature (EGT)<br><br>
<ins>Digital inputs :</ins><br>
- Car electrical system state: know if the car is used (power given to the ECU)<br>
- Engine rotations per minute (RPM)<br>
- RS232 bus to communicate with Air Fuel Ration (AFR) sensors<br></p>
<p>As you can see, this is quite a lot of inputs... that we want to display to the user. How? An LCD screen is obviously the best solution. Many of you readers know that most of the screens you see in everyday life have a <strong>very poor performance</strong> when exposed to direct sunlight. For this project, I found a 256 * 64 pixels OLED screen that is perfectly suited for this kind of application. OLED screens have the particularity to not have a backlight, each pixel producing its own light. Thus, contrast is perfect and colours pretty neat. The screen I am using is 15cm large by 5cm high, monochrome (16 levels of green)... which is again perfect for car use, to have a clear reading on the sensor values (who needs colour anyway?).<br><br></p>
<p><a href="https://www.limpkin.fr/public/ECU_CENTRAL.JPG" title="The ECU monitor in central version"><img src="https://www.limpkin.fr/public/.ECU_CENTRAL_m.jpg" alt="The ECU monitor in central version" class="media-center" title="The ECU monitor in central version, janv. 2011"></a><br></p>
<p>This picture shows the ECU monitor meant to be integrated in the central console of a car. The version you saw in the beginning is a DIN version, that can be placed in a standard car radio slot. As you can see, both of them have LEDS. Green / Orange / Red leds that are used to show the driver what his engine RPM approximately are, which is called a <a href="http://en.wikipedia.org/wiki/Shift_light" hreflang="en">Shift Light</a>. The other red leds are used as alarm leds. The ECU monitors also have 3 buttons in order for the driver to navigate through the user interface, and a USB connectivity for functionalities that I will detail later.<br></p>
<p>Obviously, this product (yes, I said product!) is used by car enthusiasts that tune their cars and try them on circuits. Thus, they wanted several features in their ECU monitor :<br>
- several ways to display the sensor information (text with small & big fonts, graphical gauges)<br>
- datalogging<br>
- logs export to their computer<br>
- easy graphical user interface<br>
- choice for several types of sensors<br></p>
<p>Let's leave the software part aside, as it may not be that relevant to you. If you want, have a look at the video at the bottom of the page where all the functionalities are detailed. Let's focus on the hardware side :<br>
<a href="https://www.limpkin.fr/public/ECU_UC.PNG" title="ECU monitor uC"><img src="https://www.limpkin.fr/public/.ECU_UC_m.jpg" alt="ECU monitor uC" class="media-center" title="ECU monitor uC, janv. 2011"></a><br>
I chose an Atmega644 from atmel, in its DIP version. It was chosen because of its many inputs / ouputs that were corresponding to my needs and its big package allowing easy soldering. As you can see on the schematic, all its pin are used! I couldn't do better... <br>
Some additional words on the hardware: to export the logs to the computer (and to upgrade the ECU monitor firmware!), I use an USB connection through the use of a standard <strong>FTDI RS232 to USB</strong> converter. For external RS232 communication with the AFR sensor, I am using a proper <strong>RS232 transceiver & transmitter</strong> that change the Atmega RS232 signal levels to levels that are specified by the RS232 protocol (usually +/- 10V). For data storage, I use <strong>I2C serial eeproms</strong> from Atmel. You may criticize this choice, as this solution is far from being the cheapest. However, as I had no other bus left on my Atmega , this was the only solution. In this ECU monitor, you can cascade up to 4 I2C serial eeproms of 1Mb each. For the parts numbers, please look at the bill of materials at the end of this article.<br>
A few words on the LCD interfacing: it uses a SPI bus with an additional signal for data / command selection, it also uses 15 Volts to drive the OLED pixels (the voltage is thus produced by a step-up from Maxim) and 2.8 Volts for digital supply. As digital inputs must be 2.8V max, voltage bridges are used to reduce the Atmega ouput voltage levels (which is a very efficient & cheap solution as the communication is one way only).<br></p>
<p><a href="https://www.limpkin.fr/public/ECU_BACK.JPG" title="The ECU monitor in DIN version, back"><img src="https://www.limpkin.fr/public/.ECU_BACK_m.jpg" alt="The ECU monitor in DIN version, back" class="media-center" title="The ECU monitor in DIN version, back, janv. 2011"></a><br></p>
<p>So here is the PCB! Components have been deliberatly chosen big for easy soldering (0805 SMT components, through hole diodes). As this product will be used by people that may not be cautious with the wiring, all the analog inputs have been protected with operational amplifiers in 1:1 mode with protective diodes. To easily connect the ECU monitor with the ECU, terminals have been placed. The black panel has been made using rapid prototyping with plaster injected with cyanoacrylate. This solution has been chosen over ABS because of the raw finition of the latter, even if the panel made of plaster may break if you use the wrong screws to attach your pcb. The PCB is double sided, has big traces on one side and a huge ground plane on the other (no need to tell you why).<br></p>
<p>Again, I am very sorry to not be able to give you all the source code I made for this project. However, if you have any question or need bits of code to get started, I would be more than happy to help you. Please also consider this board as a potential <strong>development board</strong>, as it has loads of inputs / ouputs that most people need, a LCD screen, eeproms for data storage and USB connectivity! As I told earlier, I had to make 10k lines of code to produce a firmware that satisfies everybody. Luckily, I had two wonderful product beta testers during two months, that told me what they would like to have as well as the different bugs of the firmware (there weren't that many of them ;) ). If you ever plan on creating a product, I strongly advise you to do as I did: give your product to one or two testers that will test your project in all possible ways. And don't forget to put a bootloader protected by a password, in order to upgrade your firmware on your betatesters products! Iterative improvements such as the ones for this ECU monitor are very beneficial for you (to fully test your firmware) and for your customers (so they have everythings they want!).<br>
Finally, here is the video of the final product : <br></p>
<div class="external-media" style="margin: 1em auto; text-align: center;">
<object width="480" height="295"><param name="movie" value="https://www.youtube.com/v/Zo8FvmOQ6NA?fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="https://www.youtube.com/v/Zo8FvmOQ6NA?fs=1" type="application/x-shockwave-flash" width="480" height="295" allowscriptaccess="always" allowfullscreen="true"></embed></object>
<br /><a href="https://www.youtube.com/watch?v=Zo8FvmOQ6NA">The ECU Monitor</a>
</div>
<p>You'll notice that I had access to a very good camera to shoot this video. You'll also see all the work needed to produce this firmware... almost all the 64k flash is filled.<br>
Finally, here are all the files you will need to make this ECU monitor / development board:<br></p>
<p><a href="https://www.limpkin.fr/public/Ecu_Schem.pdf">The ECU monitor schematics</a> <a href="https://www.limpkin.fr/public/Ecu_Datasheets.rar">The ECU monitor datasheets</a> <a href="https://www.limpkin.fr/public/ecu_pcb.rar">The ECU monitor production files</a> <a href="https://www.limpkin.fr/public/Components_Projet_Voiture.xlsx">The ECU monitor components</a> <a href="https://www.limpkin.fr/public/lcd.c">OLED LCD Drivers</a> <a href="https://www.limpkin.fr/public/eeprom.c">Eeprom drivers</a><br></p>
<p>Here is also a similar project <a href="http://code.google.com/p/multidisplay/" hreflang="en">here</a>, which is quite impressive.<br>
A few words on the limitations of this ECU monitor:<br>
- Obviously, it doesn't have a CAN bus connection. I might build a newer version integrating this connectivity. However, each car manufacturer has a different way to transmit the sensor informations over this bus! <br>
- Maybe I should have addded a multiplexer on the analog inputs in order to implement the possibility to have more analog inputs in the future<br>
- When the system is asleep, it still draws 20mA from the car battery. Well, it is not that much but if you are planning on leaving your car unused for more than 5 or 6 months...<br>
- I am using a 5V voltage regulator to convert the 11-14V of the battery to 5v. It is not as efficient as a step-down but when voltage variations will occur on the 12v input, the 5v ouput will not be as affected as when using a step-down. Moreover, it can handle up to 18v analog input<br><br></p>
<p>Anyway, these are just small details, but I had to also write about the disavantadges of this design ;).<br>
See you soon!</p>