I made my own "breaboard duino" on some perf board
added a lm7805 for the 12v to 5v conversion in the car.
put switches inline with the TX / RX line between the iso chip and the atmega (wouldn't program over serial otherwise)
my issue is very peculiar so i program the arduino (through the "upload code by programmer" option) with the original obduino32k code from google code and the display works fine while being powered off of the USBASP ISP connector. But, as soon as i use another 5v power supply (connecting the same as the USBASP to the 5v / gnd rails), the lcd contrast is messed up and i cant read it. same happens if i go through the vreg 12v -> 5v. All voltages were checked to be sure that the sources were ok.
Next, i tried the Hello World LCD example in the Arduino IDE and the LCD contrast works perfect with any power source. i still had to add in analogwrite for the brightness and contrast, of course.
I just did another test: i connected only the gnd and 5v from the USBASP to their respective places on the arduino, and walla the contrast issue is there. somehow the mosi / sck / msio / rst connection are doing something to make it work? makes no sense at all. So, something in the OBDuino code is messing with the contrast output... strange
Your wiring will damage your board duino for sure. Unless there is sufficient current limiting resistor not drawn, the pin 9 directly connected to anode of back light will die. I also don't like controlling contrast with PWM pin. Tried myself and got flickering results. What is your excuse of not using a simple potentiometer instead?
The voltage regulator you are using is not sufficient for in car use and the transient spikes you will see - you need to do a search for LM2596 boards - they are cheap on ebay and provide a protection circuit - i also believe (but am not certain) that the OBD interface also supplies a protected 12v output you can patch into
the contrast and birghtness of the lcd is controlled by the obduino based on the headlights etc from obd.
i was being lazy haha, so ill put in some ~200 - 300 ohm resistors on the contrast and brightness pins. my contrast is fine, but i dont see how current limiting resistors will fix it. Extra current causes over contrast?
i am using gnd / sig gnd, 12v and the k line directly from the obd connector.
The current limiting resistor will limit the current going through the back light. This is also protecting your ardino, which won't be able to supply much more than 500mA on its power supply. Sometimes the LCD would come with a resistor already soldered on but other times there is nothing between LED+ and LED- except for the LED. So I guess the problem is somewhere else.
derp. lets do some troubleshooting. ill load up a program that enables the lcd blah blah blah and do a for loop to change the contrast. should eliminate something
Ill let you guys know how it goes.
if anyone cares; code:
#include <LiquidCrystal.h>
#define LCD_RS 4
#define LCD_ENABLE 5
#define LCD_DATA1 7
#define LCD_DATA2 8
#define LCD_DATA3 12
#define LCD_DATA4 13
#define LCD_COLS 16
#define LCD_ROWS 2
// LCD Pins same as mpguino
// rs=4, enable=5, data=7,8,12,13
LiquidCrystal lcd(LCD_RS, LCD_ENABLE, LCD_DATA1, LCD_DATA2, LCD_DATA3, LCD_DATA4);
#define ContrastPin 6
#define BrightnessPin 9
void setup() {
lcd.begin(LCD_COLS, LCD_ROWS);
analogWrite(BrightnessPin,150);
delay(100);
// Print a message to the LCD.
lcd.print("hello, world!");
}
void loop() {
for (int i = 0; i<255; i+=2)
{
analogWrite(ContrastPin,i);
lcd.setCursor(0, 1);
lcd.print(i);
delay(400);
}
//51 sec to do a cycle
for (int i = 255; i>0; i-=2)
{
analogWrite(ContrastPin,i);
lcd.setCursor(0, 1);
lcd.print(i);
delay(400);
}
}
so it seems something is wrong in the code + how it reads the info from my car, but that just sparked an idea. since the iso9141 interface is still not working, it could be causing it to set the wrong contrast.
around 60-70 the contrast looked how it should. now its just this interface error any tips?