0
\$\begingroup\$

my circuit

I am still very fresh when it comes to circuits. This is a circuit that controls both an irrigation system and a solar tracking system. I have seen many circuits similar to mine where they would use a transistor instead of a relay, so my question is which is correct? Or do I need to have both to insure that my circuit runs smoothly?

I would also really appreciate if you could give me recommendations to anything you see I could improve on in this circuit.

\$\endgroup\$
7
  • 1
    \$\begingroup\$ This question is too vague because the applications between a relay and transistor are different. It might be better to ask yourself why you chose a relay over a transistor. Both provide the same end result but they behave completely different internally. I'm sure there are pros and cons for either. \$\endgroup\$
    – Colin
    Commented Mar 6 at 18:55
  • 1
    \$\begingroup\$ Your question is missing a lot of information. What types of loads are you switching? Voltage / current / AC / DC / other? What power is available for the control circuit and/or relay coils? Do the control circuits and switched load circuits have to be fully isolated from one-another? etc. \$\endgroup\$
    – AnalogKid
    Commented Mar 6 at 19:02
  • 7
    \$\begingroup\$ Welcome! Those Fritzing diagrams sure are pretty. However, they are not well received here because they tend to become very difficult to parse and decode for troubleshooting. Consider using the built in schematic tool and look through this site's guidelines and on schematic creation. Good luck! \$\endgroup\$ Commented Mar 6 at 19:12
  • 1
    \$\begingroup\$ Does this answer your question? Relay vs. Transistor? \$\endgroup\$
    – RoyC
    Commented Mar 7 at 7:34
  • 1
    \$\begingroup\$ You can and should add significant detail to the question - and some on the image would help. The panel is either 10V or 5V depending on how the cells connect (10 or 20 cells). 5V is too small to charge and10V will destroy your batteries rapidly. || Please advise: Battery type (NimH?) capacity brand model capacity | PV panel wattage, voltage, current. Web link if available. | Motor brand type voltage power rating current as available. | Relay coil voltage coil current model brand.| Similar for servo, moisture sensor, meter. || I can reopen this question if you make a god effort at the above. \$\endgroup\$
    – Russell McMahon
    Commented Mar 7 at 12:30

4 Answers 4

1
\$\begingroup\$

Transistors are great at switching loads that are local, or at least close to the main system. Their weakness is that they must share a power / ground path between the load and system that drives the load, making the whole system vulnerable to a possible short or miswire in the field.

Transistors also don’t handle AC voltages so well. You may not care about this, but many sprinkler valve systems use 12V or 24V AC.

Relays provide isolation between the control and load. They can also handle higher currents than most transistors, and they work just fine with AC or DC allowing you the option to use a low-voltage transformer for the valve power.

The downside? Relays do need some current to actuate their coils. For this application, a small reed relay with a 500 ohm coil will do, so figure 10mA for the coil. Which, by the way, is an excellent use for a transistor: use one to boost your MCU’s current output to drive a coil. (Don’t forget the catch diode across the coil.)

Besides needing coil current, what’s another drawback for relays? They don’t handle PWM control. Your sprinkler valves don't care, but you will need PWM for fine control of the PV swivel motor.

So to answer your question, use both. Relays for your field loads (solenoid valves), and transistors to drive the relay coils from your GPIOs, and your swivel motor.

Let's talk about the valves. To run them off battery, you need the type called 'DC latching'. These operate at lower voltage and don't require hold current. Maybe this one or similar (9V DC.) The downside: you will need to drive that valve current in either direction, which means you will need 2 relays per valve. But, for your trouble there will be zero idle current in the valve and relays, whether the valve is on or off.

Related: How to trigger a latch solenoid valve from an Arduino?

Now, let's talk about that swivel motor. It needs fine control, and it needs to work in either direction. It will need an H bridge to drive it and two GPIOs: one for PWM, and one for direction control.

Also, you will need a stop switch for the swivel or some means to limit motor torque.

Not sure why you need a servo. At startup, you’d index the swivel to one extent, then hunt for the best PV output. I think you can get away from the CdS cells too, but you need to modify things so that you can monitor the PV array output.

There’s some more things that need to be sorted out, but a biggie is that you cannot connect the PV array directly in parallel with ordinary batteries like alkalines: the batteries will back-drive the PV array and fry it in short order. Add blocking diodes at least.

If you intend to use Li-ion batteries, that need for isolation goes double: you need a charge controller / battery protection circuit. You might be able to get away with using NiMH or NiCd in parallel, like many solar lights do, but you still need the blocking diode to prevent back-drive.

Some ideas about solar battery chargers for garden lights: https://circuitdigest.com/electronic-circuits/solar-powered-automatic-garden-lights

Finally, I’ll toss this out there: dual-axis solar tracker kit with Arduino. Has pretty much everything you need, and it's dual-axis so that it will have better battery life.

\$\endgroup\$
2
\$\begingroup\$

There is really no single correct way to do it. There are many ways to do it correctly whether using transistors or relays. Arduino may not be able to drive the relay coil directly, so you'll keep the relay, and add a transistor to control the relay:

schematic

simulate this circuit – Schematic created using CircuitLab

Note that the motor must have its own connection going to the battery. This connection cannot be shared with other connections. That's so that the electrical noise from the motor will be "shorted" by the battery, and so that the noisy motor currents won't be shared with other loads like the Arduino etc.

\$\endgroup\$
1
  • \$\begingroup\$ You may want to add a base resistor. \$\endgroup\$ Commented Mar 7 at 19:46
0
\$\begingroup\$

Transistors are generally used for medium-power applications. High current BJTs are harder to come by and more expensive, and dissipate more power (Vce 0.6V drop). Like hacktastical said, BJTs don't handle AC voltages very well(output cannot swing below ground with a single supply).

Relays are better for high-power applications, whether they are SSRs (solid-state) or electromechanical (coil drives a switch). SSRs don't need any external circuitry (consult datasheet first) but are more expensive. Electromechanical types only require a minimum amount of current to drive the coil, plus a flyback diode to suppress back-EMF. Relays also provide some degree of isolation and can handle AC loads.

\$\endgroup\$
1
  • \$\begingroup\$ You seem to be conflating "transistor" with "BJT" here; MOSFETs are transistors too, and are perfectly suitable for driving high-current loads. \$\endgroup\$
    – Hearth
    Commented Mar 7 at 15:53
0
\$\begingroup\$

For the basic design of an electronic circuit, you have to design it from different aspects, and the question that both circuits do the same thing cannot be a sufficient reason to choose a part.

First, you should consider that your circuit has the best performance with the lowest cost so that it is attractive enough for production. Secondly, it is better not to use dip parts in your design as much as possible because it makes production more difficult and increases the cost.

Secondly, in my opinion, the relay is necessary in cases where you want to control a large current with a small current and isolate two parts from each other.

In the next step, you should draw the schematic of your circuit very clearly and cleanly so that you can make the necessary decisions based on it (For example fritzing maybe be good choice).

In the agricultural sector, for which you aim to design, in my opinion, the most important challenge for choosing parts is weather conditions, especially humidity and temperature, and in farms, the problem of electricity and radio communication. You should have to pay attention to these issues when choosing your pieces.

I saw that you used LDR to measure the amount of light, you should keep in mind that in the agricultural sector, the light used by plants is measured by a Par Meter, and the lux meter measures the light as perceived by the human eye, of light that hits or passes through a surface.

There are different types of soil sensors, such as frequency, resistance, and tensiometers, which you can find the right option for you according to the type of soil.

Another challenge that I had in the design of devices for the agricultural sector was the selection of LCDs for them, because the amount of ambient light in the agricultural sectors is very high, and you should be aware of this issue as well.

\$\endgroup\$
3
  • \$\begingroup\$ "Par Meter, and the lux meter only measures the intensity of the ambient light." The only difference is in the filter or transfer function between the two. For OPs usage, ignoring the overly high responsivity for green light would still be good enough to make a solar tracking system, just a k-factor for correction. \$\endgroup\$
    – winny
    Commented Mar 7 at 15:51
  • \$\begingroup\$ Hi @winny Thank you for your valuable point. Do you know a sensor that can measure Par indivitualy? I only need that sensor IC and not the whole device. \$\endgroup\$ Commented Mar 7 at 16:11
  • 1
    \$\begingroup\$ Product recommendations are off topic here but the surely exist. A minus green filter (magenta-ish) + regular photo sensor would get you close. \$\endgroup\$
    – winny
    Commented Mar 7 at 16:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.