Problem with LCD and Motor

No, you've now broken the connection between mosfet source and Arduino ground.

you've now broken the connection between mosfet source and Arduino ground

There is one ground on the modified PSU (+5, +12, Gnd), so technically the source of the mosfet is connected to the arduino ground via the power supply wiring. The two grounds on the PCB are connected, just with 3 inches of wire instead of a trace. Should I still do this locally on the board as well? (i.e. add trace from mosfet source to arduino ground).

My recommendation is to connect the ground line locally on the board instead of off-board. Take the ground feed to the Arduino from the -ve side of that 1000uF capacitor, so that capacitor leg is the junction between the wires to mosfet source, power supply ground, and Arduino ground. This will help to minimize switching noise feeding back to the Arduino. Also connect a 0.1uF ceramic capacitor in parallel with the 1000uF.

Will do. Thank you so much for your help. I will be isolation routing this today on the CNC.

This seems to have solved the problem, but now I just found a new one with my LCD display.

When I turn the contrast down - with 10K pot - below a certain level, and back up again, It displays strange characters, and must be reset. This is regardless of whether I have the logic pins connected or not. It's not a big issue, as I leave it turned up anyway, but just curious as to what could be causing this.

This is after an hour of wondering why the contrast didn't adjust at all only to find out the pin2 and pin 3 are swapped on my particular HD44780 compatible LCD (JHD204A - made in China).

but just curious as to what could be causing this.

You may have the potentiometer miswired so that it is shorting the power supply (and overloading the potentiometer) when you turn it to one end.

This is after an hour of wondering why the contrast didn't adjust at all only to find out the pin2 and pin 3 are swapped on my particular HD44780 compatible LCD (JHD204A - made in China).

I doubt it. Are you sure you haven't misinterpreted or miswired the potentiometer pins.

Don

Sorry I ran away while everyone else here is kicking the ball. Could you post some hi-res pictures of how you connected the pot? I have the same suspicion as floresta. Unless you supply a picture, nobody can be sure you connected the wires correctly. Is it possible that pins 2 and 3 or pins 1 and 2 are shorted with solder bridge?

A little tight and messy for a picture. I'm sure the pot is wired correctly, as a voltage divider. Wiper (center) to Pin 2 of LCD, one side to ground, other side to +5V. I even swapped out the pot, and same thing occurs. I even checked to make sure it was a linear pot and not log taper.

I am positive the pins 2 and 3 are swapped, and there are no solder bridges. I also had read in another forum that someone else had a JHD204A with swapped pins 2 and 3.

Oh silly me, silly me. I thought contrast was supposed to fade the lcd (characters) and not the backlight. I swapped the pot to pin 3, and all is well in silly land.

So the pins aren't switched, but my brain synapses are!

Oops, yet another brainfart. When I swapped the pins back to Pin2 5V and Pin3 Pot, I forgot I had the anode of the display (pin 15) linked to pin 3 (as I originally thought Pin 3 was Vcc. So in actuality, I was placing a voltage divider in the LED (backlight) circuit.

I am confident now that Pin 2 is Vcc as all HD44780's are. However, now I find that contrast does nothing at all if I wire everything up as correct. This is the main reason I swapped pin 2 and pin 3 originally. I prefer the way it's set up now anyway. I would much rather control the backlight anyway. Here's my hookup with contrast NOT working.

Pin 1 - Ground
Pin 2 - Vcc (+5V)
Pin 3 - Vo (wiper of potentiometer to pin 3 with one side to 5V and other side to ground).
Pin 15 - +5V through 330 ohm resistor
Pin 16 - Ground

now I find that contrast does nothing at all if I wire everything up as correct.

You probably burned out the potentiometer when it was wired incorrectly. I mentioned this in reply #23: "You may have the potentiometer miswired so that it is shorting the power supply (and overloading the potentiometer) when you turn it to one end."

Don

You probably burned out the potentiometer when it was wired incorrectly.

Nope. Potentiometer is OK. I even swapped it out. This problem was present "out of the box" when I recieved the LCD. Plus, the potentiometer was never wired incorrectly, I just accidentally wired it to the backlight circuit (as voltage divider, so safe), but long after I first tested the LCD upon receiving it.

Nope. Potentiometer is OK. I even swapped it out.

OK - Can you verify that the voltage at pin 3 is varying when you turn the potentiometer knob?

Don

Can you verify that the voltage at pin 3 is varying when you turn the potentiometer knob?

That's the first thing I checked. Yes. 0V to 5V. Meter connected Pin 3 to ground. Fluke 175 meter.

I'm having the same symptoms when using a 5v relay to switch current from a 12v supply to a solenoid. I put a 2n4004 diode across the coils of the relay and the solenoid to short the back EMF, but no joy. It works OK with just the relay clicking on and off, but one or two cycles of the 12v solenoid takes out the LCD. Should I try the capacitor across either or both DC supplies?

I'm confused. Is it working already or do you still have problems?! BTW, if you intend to use a pot to adjust back light, use a 100 ohm pot and have a 47 ohm resistor in series. You don't use 10Kohm pot for back light, which only gives you like, on (burn the back light) and off.

liudr,

Read the past posts. I hooked up wrong to the backlite, and the pot worked to dim the backlight. I hooked up as it should have been, and the LCD contrast does not work.

Now I have a 330 ohm in series with the backlight and control the brightness with a 10k pot. It works. Still, pin 3 does not adjust contrast.

DRBArduino,

yes, It worked for me. Filtering is your friend and caps seem to work.

wbegg:
liudr,

Read the past posts. I hooked up wrong to the backlite, and the pot worked to dim the backlight. I hooked up as it should have been, and the LCD contrast does not work.

Now I have a 330 ohm in series with the backlight and control the brightness with a 10k pot. It works. Still, pin 3 does not adjust contrast.

That's good summary. I still don't recommend using 10K pot for backlight though but I get how overconfident you are so do what you want. So now you can't make the contrast to change. Please disconnect all data, RS, EN wires from the LCD if you want to try the contrast. I didn't get whether you are running some LCD code or not. Just don't run LCD code and get the contrast step to work first. Bear in mind, you did connect up wrong wires so the LCD may have already been damaged beyond operation. Things happen rather quickly when wires are connected up wrong. Again, where are those pictures? You apparently were overconfident and under-organized but a few pictures will redeem yourself here. You were "connecting everything correctly" and that made several helpers think hard what other things could have gone wrong, all wasting their time, only if you showed a pic or two.

Tried another LCD and it works. Guess the contrast circuit on the one in question is Fubared.