plant watering

Showroom for MicroPython related hardware projects.
Target audience: Users wanting to show off their project!
johnv
Posts: 25
Joined: Sun Nov 10, 2019 6:01 pm

Re: plant watering

Post by johnv » Sat Dec 07, 2019 11:13 am

tnx MostlyHarmless, i will look into it
apreciate the help man!

User avatar
MostlyHarmless
Posts: 166
Joined: Thu Nov 21, 2019 6:25 pm
Location: Pennsylvania, USA

Re: plant watering

Post by MostlyHarmless » Sat Dec 07, 2019 4:11 pm

johnv wrote:
Sat Dec 07, 2019 11:09 am
i encountered another problem,

the relay is 5v in the kit and the nodemcu only puts out a 3.3v
From the photo of the kit it seems there is something like a transistor and other components on that little breakout board with the relay. If this is supposed to be directly connected to the MCU, then those components should be a transistor (probably BC337 or similar) which is switching the relay, a base resistor through which the MCU is connected to the transistor's base (the MCU being on 3V3 I'd pick a 2K2) and a flyback diode (a 1N4001 will do) across the relay coil to protect the transistor. But without a schematic of that little board one can't tell what they used. The components I mentioned are just stuff I have normally floating around.
johnv wrote:
Sat Dec 07, 2019 11:09 am
so i ordered a pack of 3v relays,
Careful there. You should not connect the coil of a regular relay directly to the output of the MCU. Most relays draw too much current and will damage the MCU. That's what all the components above are for, to drive the relay on the voltage it needs with a transistor.

I have driven 12V relays (Omron G2RL-2) by using a ULN2803 Darlington transistor array. One of those little things can control up to 8 relays and they only cost a dollar when you buy them in 10-packs. They have everything on board to connect the inputs directly to the MCU GPIO pins and their outputs can handle up to 50V. They even provide the flyback diode inside. Yes, I am that lazy.


Regards, Jan

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: plant watering

Post by Roberthh » Sat Dec 07, 2019 5:40 pm

We had discussions about these typed of relay board here already a few times. They all had a small PNP transistor, and the base connected though a LED and a resistor in series to the input. Looking at what I can see in the picture here it seems to be the same. In that case, some kind of level shift is required, potentially with a single transistor. Thanks for you hint about the ULN2803, a ver useful part (43c here in low quantities, less if more). For the actual application my favorite would be a single 2N7000 transistor.

P.S.: All resistors I see in the picture a 1k Ohm.

User avatar
MostlyHarmless
Posts: 166
Joined: Thu Nov 21, 2019 6:25 pm
Location: Pennsylvania, USA

Re: plant watering

Post by MostlyHarmless » Sat Dec 07, 2019 6:16 pm

Roberthh wrote:
Sat Dec 07, 2019 5:40 pm
Thanks for you hint about the ULN2803, a ver useful part (43c here in low quantities, less if more). For the actual application my favorite would be a single 2N7000 transistor.
43 Euro-Cents a piece? That is cheap! Mouser has the ULN2803A listed at $1.02 in quantities of 10 in DIP package right now. In any case, one of those is what I always plug right next whenever I put an experiment board onto a breadboard. It has become some SOP. Sooner or later it will be needed. Might as well reserve the breadboard space upfront.

Re 2N7000: A MOSFET is definitely an interesting choice too. But we should guide the OP first through NPN and PNP basics before adding those to the mix.


Regards, Jan

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: plant watering

Post by Roberthh » Sat Dec 07, 2019 7:06 pm

But we should guide the OP first through NPN and PNP basics before adding those to the mix.
That may be a generation issue. If I would start today, I'd start with MOSFET. So much easier to use. My first transistors as a young lad were Germanium ones - of he 'solder and pray' type. Silicon was a huge improvement then.

User avatar
MostlyHarmless
Posts: 166
Joined: Thu Nov 21, 2019 6:25 pm
Location: Pennsylvania, USA

Re: plant watering

Post by MostlyHarmless » Sat Dec 07, 2019 7:42 pm

Roberthh wrote:
Sat Dec 07, 2019 7:06 pm
But we should guide the OP first through NPN and PNP basics before adding those to the mix.
That may be a generation issue. If I would start today, I'd start with MOSFET. So much easier to use. My first transistors as a young lad were Germanium ones - of he 'solder and pray' type. Silicon was a huge improvement then.
Transistors in TO-18 packaging. I remember them.

Yeah, one of the first books I ever bought about electronics was (memory is fuzzy) something like "100 Transistor Circuits", that I found at BaLü (Bauteile Lück) in the Alsterhaus in Hamburg. That was in the late 70's and while the MOSFET stuff looked so good, those were quite expensive and even harder to find back then.

Maybe I never grew up and thus still default to NPN and PNP stuff.

A short while later I bought 101 BASIC Computer Games and played those on a Tandy CoCo. You remember that?

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: plant watering

Post by Roberthh » Sat Dec 07, 2019 8:43 pm

A short while later I bought 101 BASIC Computer Games and played those on a Tandy CoCo. You remember that?
No. Never had a Tandy computer or the like. Must have been a lot of fun these days.

User avatar
MostlyHarmless
Posts: 166
Joined: Thu Nov 21, 2019 6:25 pm
Location: Pennsylvania, USA

Re: plant watering

Post by MostlyHarmless » Sat Dec 07, 2019 10:15 pm

Roberthh wrote:
Sat Dec 07, 2019 8:43 pm
A short while later I bought 101 BASIC Computer Games and played those on a Tandy CoCo. You remember that?
No. Never had a Tandy computer or the like. Must have been a lot of fun these days.
Indeed. First a 32K version of the Tandy CoCo, then a Schneider CPC-464, which I upgraded to 128K memory so that I could run CP/M Plus.

My next system had 768K of RAM, a NEC V20 CPU @4.77 MHz and a 10MB harddrive. On that system I typed "make world" for the first time in 1987. Minix 1.3 completely built from source code! The whole OS and every single command line utility. Took only two days or so.

Imagine that ... and we keep bitching about low RAM and build times.

johnv
Posts: 25
Joined: Sun Nov 10, 2019 6:01 pm

Re: plant watering

Post by johnv » Sun Dec 08, 2019 8:13 am

cool, i will look into it!

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: plant watering

Post by pythoncoder » Sun Dec 08, 2019 8:26 am

Roberthh wrote:
Sat Dec 07, 2019 7:06 pm
...My first transistors as a young lad were Germanium ones - of he 'solder and pray' type. Silicon was a huge improvement then.
Transistors? Transistors??? Bah, newfangled stuff. I started out with valves bought from London war-surplus dealers. I was astonished when I first got to use germanium transistors. No more chassis-drilling. Or 300VDC shocks...

As for home computing, by the time microprocessors came along I had a clue what I was doing. I designed and built my own with a home-brew OS. It was really a development system/in-circuit emulator and it earned me a living for a few years, writing firmware in assembler. And here it is ;)

Image
Peter Hinch
Index to my micropython libraries.

Post Reply