I know there are some topics similar to this one, but I can't seem to make my project to work correctly.
Basically what I have is a watering system: I read values of moisture from 2 sensors, show the values on the LCD display, start the pump if the moisture is lower than a threshold. The motor is powered by a USB adapter (iPhone charger basically), the arduino also from a USB phone charger. Additional elements are a switch button to turn the LCD backlight on/off, and a MOSFET (I should have really used a normal transistor but didn't have one available) to control the LCD backlight from code.
What happens is that when the DC motor starts, the LCD prints weird values, and then it stays like this, ie only random characters are shown, the LCD never goes back to showing meaningful info. The code runs anyway as the pump starts from time to time.
I tried adding a capacitor to smooth out currents, but that didn't help. So I'm kind of out of options!
I attach a Fritzing schematics (sorry, it's the first time I do one!)
PS: there's also another problem being the sensors values being very erratic, but I'd love to solve the LCD one first.
First, just try a 100 µF capacitor directly across pins 1 and 2 of the display.
That might help. Now for the complaints!
Do not post PDFs. They are not compatible with Web browsing. Use proper image formats (PNG).
Expand!
Do not connect the contrast potentiometer to the 5 V. That is a longstanding mistake. Either leave that end unconnected or for a 10k potentiometer, connect it to ground as well. This will make contrast setting much easier.
The button should preferably connect to ground with a pull-up to 5 V - that is the preferred and safer way to operate buttons. You might use the internal pull-up in the Arduino or 4k7 or 10k. 220 Ohms (according to the image) is probably excessively low.
If the motor switch is indeed an NPN transistor, it must have a base resistor. If a FET (preferable) it probably does not need one. This may be part of your problem,
The wiring of the backlight control transistor is extremely odd, to say the least, and the same thing applies regarding a base resistor.
The erratic sensor values are probably because those crude "sensors" are rubbish!
Paul__B:
Do not post PDFs. They are not compatible with Web browsing. Use proper image formats (PNG).
Huh? What browser are you using?
I bring up pdf files all the time using FireFox.
Depending on how the browser is configured, the pdf is viewable directly in the browser itself, or it can be viewed in the chosen external tool/program.
As do I, though it is causing considerable grief on my Mint machine - keeps consuming all memory and crashing the system. And the pdf viewer is not in the Mint version.
In any case, there is simply no way to incorporate a pdf into a Web page, so I transcoded (actually, "Shutter") his pdf into a png to make it useful. In the process I chopped off the "fritzing" label.
I use linux mint. Currently 17.3 but about to jump to 20 (I can't really avoid systemd anymore....)
I've been using various Mint versions for around 12 years.
(Windows is not allowed to boot natively on any of my machines)
Gnome 3 has made a mess of things, so these days I prefer using Mint mate as it kind of gets you most of what was available in gnome 2 from 10 years ago.
I've never had an issue viewing pdf files using Firefox. Either using the built in viewer inside the browser (which is a bit too slow for my taste) or having firefox automatically launch one of the external pdf viewers.