in reply to Re: Controlling USB on Raspberry Pi
in thread Controlling USB on Raspberry Pi

It simply does not matter if it takes 0.1 ms, 1 ms, 10 ms or 100 ms to switch the relais

Too right...the script to open/close the curtains will probably run from CRON every 10 minutes or so with an updater script running from CRON a couple of times a day. So timing is not critical.

Just make sure the relais can switch the current (A) and voltage (V) required by the electric curtains

The curtain motor is 12V 1A so no worries there. It probably doesn't actually need a relay as a thyristor should do it but relays are simpler as I won't have much access to the motor setup whilst building the controller.

Replies are listed 'Best First'.
Re^3: Controlling USB on Raspberry Pi
by afoken (Canon) on Dec 05, 2020 at 16:40 UTC
    It probably doesn't actually need a relay as a thyristor should do it

    Thyristors have a very different switching behaviour compared to a relais. Once triggered by a gate pulse, they stay on until the load current drops (close) to zero. On a DC supply, a thyristor stays on until power is switched off or the motor burns out. However, with pulsing DC current (i.e. AC after a rectifier, but no capacitor), the thyristor will switch off at the end of a half wave. This allows tricks like a crude PWM regulator by triggering the thyristor somewhat after the begin of a half wave (Proxxon uses this trick for their "DC" minimot tools).

    For driving AC motors, a thyristor won't help you much, as it either isolates or behaves like a diode, so the AC motor gets either no current or pulsed DC.

    For full control of a DC motor on a DC supply, you typically use an H-bridge setup with bipolar or MOSFET transistors. This allows PWM for speed control, turning left and right, braking (not with every controller) and coasting. There are severel very clever H-bridge driver ICs available that add a lot of protection for both motor (e.g. stall and overcurrent detection) and driver transistors (overcurrent, short circuit detection). Some H-bridge driver ICs even include the transistors. And yes, there are cheap, ready-to-use modules with H-bridges.

    H-Bridge drivers either accept a direction and a speed signal (on/off or PWM), or a left-turn and a right-turn signal (again either on/off or PWM). If breaking is supported, the direction-and-speed signals need a third signal to switch between breaking and coasting, the left/right approach can use the illegal state (left and right on at the same time) for breaking, or also use a third signal line. After all, driving a solid-state H-bridge is not too different from driving two relays. Two "slow" bits are sufficient for switching left/off/right, you may need to add a third bit for breaking. With a direction-and-speed driver, change one "slow" bit to PWM output to allow speed control.

    L298-based modules seem to be very popular (two motor up to 46 V, each 3 A abs max peak, each 2 A operating, logic supply 4.5 V to 7 V, logic levels should be just about compatible with 3.3 V signals, motor drivers can be paralleled for double output current), just add a heatsink, four diodes per motor and some passives to the chip and you have a driver module. Only downside is that the L298 is everything but smart, no protection except for shorting out the motor supply.


    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)