Arduino clock replacement build for my Celica

Discussion in 'Off-Topic' started by Chux, Sep 25, 2017.

  1. Chux
    Offline

    Chux Well-Known Member

    Likes Received:
    1,453
    Trophy Points:
    398
    Lately my Celica ('91 GT Convertible, if you were wondering) has a very slight hesitation. Not really a big deal, but I'd like to fix it, and I can't quite put my finger on it.

    A couple weeks ago, I was driving it thinking, "I'd sure like to be able to monitor AFRs in this without having to mount a gauge". Then I looked at the clock in the center of the dash (which randomly resets itself. Probably a broken solder joint, but there's a clock on the radio...so whatever), and thought that would be a great place to display some information....

    Some thinking, and googling, and I found this:
    https://www.instructables.com/id/Custom-OBD-II-Gauge-in-With-OEM-Look/

    It's in a BRZ, and the code is written to read the data from the OBD II port, but the arduino has Analog read capability....

    So after making some measurements, I ordered the exact hardware that he used (Adafruit pro trinket 5v, and 128x32 SPI OLED display). Last week I hacked up the stock radio, soldered some wires to the 4 traces for the 3 buttons (3 signal wires, one common).

    [​IMG]20170923_185526 by Numbchux, on Flickr

    I had to cut a notch in the board for the wires to pass through. I might have to cut through the one trace I'm using for the buttons to get the display centered vertically in the housing. So I might have to run a wire around it, but we'll see.
    [​IMG]20170923_185432 by Numbchux, on Flickr

    With the test program installed, and the first test fit in the dash piece.
    [​IMG]2017-09-22_08-29-47 by Numbchux, on Flickr

    This weekend I soldered a couple resistors onto a board to give the 3 signal wires from the buttons different resistance values (so they can all be wired into the same input on the arduino)
    [​IMG]20170924_165403 by Numbchux, on Flickr

    And wrote a small test program to test my oil logo, and to display the values generated by the 3 buttons:
    [​IMG]20170923_182330 by Numbchux, on Flickr

    Today I ordered this bare-board wideband controller, as well as a sensor and connector
    https://www.14point7.com/products/spartan-2-oem
    and a simple voltage divider board from another source so it can convert battery voltage to 0-5v that the arduino can read.


    Plan is to have it display AFR, battery/alt voltage, Intake temp, Ambient temp, Coolant temp, and oil pressure.
     
    EricS, pleiades, GrawvyRobber and 6 others like this.
  2. JasonoJordan
    Offline

    JasonoJordan Well-Known Member

    Likes Received:
    1,698
    Trophy Points:
    398
    Keep us posted. maybe something I need to do in my brz.
     
  3. jubella2
    Offline

    jubella2 GC8 FTW

    Likes Received:
    223
    Trophy Points:
    248
    This is awesome!
     
  4. retreif
    Offline

    retreif Well-Known Member

    Likes Received:
    623
    Trophy Points:
    298
    Love the adafruit stuff. Built a couple of the kits including that awesome Ice Tube Clock.
     
  5. silver03
    Offline

    silver03 Well-Known Member

    Likes Received:
    1,304
    Trophy Points:
    348
    There is only one @Chux. Amazing!
     
    tangledupinblu likes this.
  6. Chux
    Offline

    Chux Well-Known Member

    Likes Received:
    1,453
    Trophy Points:
    398
    pleiades, GrawvyRobber and CarpalTomO like this.
  7. Krazylegz1485
    Offline

    Krazylegz1485 Well-Known Member

    Likes Received:
    3,534
    Trophy Points:
    348
    This is frickin awesome. Wish I had that knowledge in the bank.
     
  8. Chux
    Offline

    Chux Well-Known Member

    Likes Received:
    1,453
    Trophy Points:
    398
    It's surprisingly easy. I've experimented a little with simple coding, and never had much luck with it....but this is coming pretty quickly to me.

    The Arduino support base is really strong, and between the sample program for this display, and the program STiRobot wrote (which would probably mostly work right out of the box on most OBD II cars), I'm writing very little new code, just modifying things for my application.
     
    Eazy_E_Rich likes this.
  9. Chux
    Offline

    Chux Well-Known Member

    Likes Received:
    1,453
    Trophy Points:
    398
    14point7 Spartan2 OEM wideband controller and bosch 4.9 sensor arrived yesterday (and the Toyota O2 flange last week)
    [​IMG]2017-10-04_08-20-50 by Numbchux, on Flickr

    Voltage divider just cleared customs from Hong Kong (because budget build). Then I can really dial in the calibrations for temperatures.
     
    tangledupinblu likes this.
  10. silverD
    Offline

    silverD Active Member

    Likes Received:
    4
    Trophy Points:
    88
    Wow, nice project! I like the stealth look. Keep up the good work.
     
  11. Chux
    Offline

    Chux Well-Known Member

    Likes Received:
    1,453
    Trophy Points:
    398
    Shortly after that last post, I put the Celica in storage for the winter, and this project fell off my radar.

    Well, it's back on the road, the other cars are in good shape, so I'm back at this. I ran wires through the firewall for the wideband, and found the main body connector where I can tap into powers and signals that I want to experiment with.

    I did a mock-up in the car, and in the daylight, the display is too dim (especially with the top down). So I cut a window in the tinted lens. I also put an LED in there which the 14point7 controller can use to display when the sensor is warming up.

    [​IMG]
    2018-05-24_09-27-09
    by Numbchux, on Flickr


    I'm having troubles with voltage dividers. I want to be able to read battery voltage, but the analog inputs are only designed for 0-5v, so the logical option is a voltage divider. It's been done thousands of times, it's a simple circuit, and well documented. I got an "off-the shelf" arduino voltage divider (from china), but got no voltage coming out of it. So I did the math, ordered some resistors from digi-key (when I ordered the LED and resistor for the above modification), and set up my own. But again, no power coming out of it. Resistors ohm out as expected individually and together, and no voltage coming out (positive probe between the resistors, common ground), tested on the car, and then I tore it apart and bench tested it with a 12v AC/DC converter.
     
  12. Todd
    Offline

    Todd The Originator Staff Member

    Likes Received:
    137
    Trophy Points:
    228
    Can you draw me the circuit?
     
  13. Chin
    Offline

    Chin Well-Known Member

    Likes Received:
    82
    Trophy Points:
    233
    Woohoo... Analog Electronics 101...feels like I am back in school. As Todd asked, show us a drawing... They should all be in series between 5V and GND. Tap off in between each adjacent pair. Sum of all the resistances will determine the current (I= V/R). To find the voltage at any tap: calculate the ratio of resistance between GND and the tap point over the total resistance, and multiply by the input voltage (5V in this case). So, if you had one 80Ohm and then one 20Ohm resistor is series, the total current would be 50mA (0.05A), and the voltage between the resistors would be 1V ([20/100]*5).
     
  14. Chux
    Offline

    Chux Well-Known Member

    Likes Received:
    1,453
    Trophy Points:
    398
    Yea, seems like it should be a super simple circuit, but I can't seem to get it to work.

    I started with this little bastard. https://www.geekbuying.com/item/Ard...odule-Compatible-With-RPi---STM32-343459.html

    Seemed like a simple solution, but I could not get anything out of it. It was designed for a much higher voltage range than I needed, so I was pretty quick to give up on it. But even with my homemade setup (which I jumped right in and wired in the harness and tested on the car, and then cut out and bench tested after it didn't work) I'm getting nothing.

    [​IMG]
    2018-05-31_09-30-03
    by Numbchux, on Flickr

    Resistor tests
    [​IMG]
    20180520_161925
    by Numbchux, on Flickr
    [​IMG]
    20180520_161850
    by Numbchux, on Flickr
    [​IMG]
    20180520_162022
    by Numbchux, on Flickr

    Voltage in, using a 12v DC power supply:
    [​IMG]
    20180520_162122
    by Numbchux, on Flickr

    .02 V coming out
    [​IMG]
    20180520_162138
    by Numbchux, on Flickr
     
  15. predavore
    Offline

    predavore Well-Known Member

    Likes Received:
    645
    Trophy Points:
    298
    You could hook up the horn as another button and make it display an angry face or something each time you honk. Or as a security light and make it show a gun or whatever.
     
    Chux likes this.
  16. Chin
    Offline

    Chin Well-Known Member

    Likes Received:
    82
    Trophy Points:
    233
    First...who the hell designed that DMM?! I cannot tell what is supposed to be a decimal, and what is a 'selection'. Anyway...

    Not all of the pictures are showing for me on Flickr. Also, I cannot read the color bands accurately, so I will have to trust that your assessment of the resistance is correct.

    So, going from the 'voltage in' pic to the '.02V coming out' pic... Did you just pick up the pos probe and move it to the other side of the resistor, or did you do something in between measurements (both probes were removed)? What do you get if you measure the voltage across the 1M resistor? Just trying to determine if you have a bad connection.
     
    CornyTumbleweed likes this.
  17. Chux
    Offline

    Chux Well-Known Member

    Likes Received:
    1,453
    Trophy Points:
    398
    Yea, reading the decimals on that thing is a little weird. They all display all the time, but depending where you have the dial set depends which one you use...took me some time to get used to, but other than that, I like it.

    I don't know what's up with the Flickr links, it'll work one time, and then not the next. Here's the album link: https://www.flickr.com/photos/48523836@N06/albums/72157686180046115

    It's reading 993k on one and 297k on the other, and 1290k combined.

    The negative probe didn't move at all between the combined resistance reading, voltage input, and voltage output. I can't tell you how many times I shuffled things around to make sure I was getting a good connection. It seemed like the only explanation, but I'm confident the connections are good.
     
  18. Todd
    Offline

    Todd The Originator Staff Member

    Likes Received:
    137
    Trophy Points:
    228
    The math looks good.
    12.2V / 1290K ohms (total resistance) = 0.0000094A
    993K ohms * 0.0000094A = 9.33 volt drop
    297K ohms * 0.0000094A = 2.79 volts

    9.33 + 2.79 = 12.12V

    What does the Arduino use for sensor reference ground?
     
  19. Chin
    Offline

    Chin Well-Known Member

    Likes Received:
    82
    Trophy Points:
    233
    This is all independent to the Arduino, based on what I am seeing, correct? Assuming such, this is just a simple V=IR circuit.

    Hmmm...don't know what else to say without getting a hands-on. You verified the voltage and the resistance, the rest is physics.
     
    Chux likes this.
  20. joebush44
    Offline

    joebush44 Well-Known Member

    Likes Received:
    1,532
    Trophy Points:
    348


    Y'all smart.
     
  21. Chux
    Offline

    Chux Well-Known Member

    Likes Received:
    1,453
    Trophy Points:
    398
    For the record, I haven't touched it since then. Best place to work on it is the table in the house, but with a 15 month old daughter, I don't get stuff set up unless I have some serious time to work.

    It doesn't have a separate reference pin like an ECU would, so it's just using the ground from the power supply. Certainly a variable.

    But, I originally hooked it right up to the arduino, but I've since isolated it so it's just the resistors, multi-meter, and power supply.

    Thanks for confirming that I should be doing it right, anyway. It was a weird day when I googled whether resistors have polarity.....

    I'll get back to it, sometime.
     
    Chin likes this.
  22. EricS
    Offline

    EricS Nooberator

    Likes Received:
    1,061
    Trophy Points:
    248
    Don't use the Batt selections on the multimeter, switch to the regular Voltage measurement and I'm 99% sure it will be fine. The Batt test puts 10-20mA drain through what it's connected to (simulating a load on the battery) and measures how the battery responds. It's going to give you all sorts of wacky readings when you try to use it for what you're measuring.
     
  23. EricS
    Offline

    EricS Nooberator

    Likes Received:
    1,061
    Trophy Points:
    248
    Does your Arduino have overvoltage protection on the analog inputs? Otherwise car electrical systems are prone to voltage spikes that could kill unprotected analog ins. Also just FYI for future reference, you'd get more accurate measurements if the resistors were something like 100k/30k instead of 1M/300k.
     
    Chux likes this.
  24. Chin
    Offline

    Chin Well-Known Member

    Likes Received:
    82
    Trophy Points:
    233
    I thought that, as well, but when I pulled the manual for that meter they didn't mention load testing... I went back and found a reference elsewhere: 4mA test current when in Battery Mode. Good call.
     
  25. Chux
    Offline

    Chux Well-Known Member

    Likes Received:
    1,453
    Trophy Points:
    398
    hmm...that's an interesting development. Never occurred to me.

    It does not have any built in voltage protection. That's part of how I picked this ratio of resistors, as the input voltage would have to get over 21V in order for the output to hit 5V. My other 0-5V input is coming from a wideband controller, so I'm not worried about over voltage there. And the rest will be reading resistance.