LCD + backpack on SPI bus on Arduino Uno

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
saxonpaul92
 
Posts: 28
Joined: Tue Jan 01, 2013 4:40 pm

LCD + backpack on SPI bus on Arduino Uno

Post by saxonpaul92 »

Greetings,

Here is the hardware:

1. 20X4 LCD
2. Adafruit LCD backpack connected to the SPI bus. 3 foot RJ-45 (Shielded) from the arduino to the LCD+backpack
3. ds1307 RTC on I2C bus
4. Arduino Uno
5. Sainsmart 4 relay shield
6. Arduino protoshield
7. temp probe
8. float switches
9. water pump

everything works as expected until the water pump is powered on/off. When the pump turns off the LCD appears to lose sync with the SPI bus and the LCD displays junk data.

I have tried a couple of hardware/software fixes.

1. originally the LCD+backpack and RTC were on the I2C bus. LCD backpack addr(3) and RTC addr (0). There was way to much interference with this setup and the LCD would lose synch and the clock would lose time very quickly...move the LCD+backpack to the SPI bus (soldered the SPI jumper on the backpack), and the clock and display showed improvement except when the relay for the water pump turns off then, the LCD shows junk.

2. 45 seconds after the water pump relay turns off, reset the LCD. Did not help
3. Before the pump turns on, turn off the display then after the pump turns off, turn the display back on. Did not help
4. Send a software RST to the arduino after the pump turns off. This works but all the relays engage very briefly upon reset and this causes an unacceptable response to the reset of the project.

Has anyone run into this type of issue and how can I filter out any noise that may be occurring on the bus?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: LCD + backpack on SPI bus on Arduino Uno

Post by adafruit_support_bill »

My first suspicion would be the LCD display. I have seen several cases where they go wacky due to power-line spikes caused by motors turning on and off. It is not enough to power cycle the display. You have to re-send all the start-up commands to re-initialize it.

Things to try:
Isolate the display & wiring from any pump wiring. Shielded wire may help.
Use a separate power supply. (In one case, I had interference from a compressor motor and had to plug the power supply into a completely different circuit).

User avatar
saxonpaul92
 
Posts: 28
Joined: Tue Jan 01, 2013 4:40 pm

Re: LCD + backpack on SPI bus on Arduino Uno

Post by saxonpaul92 »

Can you please be a little more specific in regards to the comment "You have to re-send all the start-up commands to re-initialize it"

I already have the cabling shielded and I have thought about moving the display to a metal box. Currently it is in an plastic project box.

BTW, I used this display before with no backpack and had the same issues

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: LCD + backpack on SPI bus on Arduino Uno

Post by adafruit_support_rick »

Try calling lcd.begin() again.

User avatar
saxonpaul92
 
Posts: 28
Joined: Tue Jan 01, 2013 4:40 pm

Re: LCD + backpack on SPI bus on Arduino Uno

Post by saxonpaul92 »

That was very good advice...Here is how I solved this problem...

1. In the setup routine I made the initialization of the LCD lcd.begin() is the last line.
2. I also added a delay of 1000ms to allow all the sensors, probes and relays to initialize before starting the LCD.
3. As it turns out, I have a PH probe who initialization took a little time. This wreaked havoc if the probe wasn't able to read and thus display the output on the LCD when the LCD initialialized...initializing the LCD last and giving it an extra second allows the pH probe to initialize.
4. If you haven't guessed this project is an aquarium controller and I designed the auto top-off to be as fail-safe as possible (another time). In short the top-off pump turns on every 6 hours and for a maximum of 30 seconds...This action was causing noise on the SPI bus and thus freaking out the LCD. So, every 6 hours and 35 seconds I reinitialize the LCD. If there are any problems with LCD it will be cleared within seconds of the top off circuit shuts off.

In think the problem is 2 fold.

The first is the initialization sequence and the second is either noise on the SPI latch or a drop of VCC when the relay turns on/off.

Thanks for the advice

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”