Raspberry Pi Driving a Relay using GPIO

Posted on Feb 5, 2014

There are only four components required, and the cost for these is around 70p, so it would be a good candidate for a classroom exercise. Even a cheap relay like the Omron G5LA-1 5DC can switch loads of 10A at 240V. A word of caution: don`t tinker with mains voltages unless you`re really (really) sure about what you`re doing. A mechanical relay allows a safe learning environment,

Raspberry Pi Driving a Relay using GPIO
Click here to download the full size of the above Circuit.

since you can switch any load with it (e. g. a 9V DC battery/bulb circuit for testing), and the concept of a mechanical switch is very easy to grasp. A more efficient alternative to switch an AC load would be to use a solid-state relay (e. g. opto-coupled Triac), but it`s quite easy to make a wrong assumption and blow everything up with a loud bang and a big spark. I recommend sticking with mechanical relays until you`re entirely sure about what you`re doing. Tip: you can buy plug-in low-voltage AC power-supplies if you want to play with triacs. There are four components to this circuit. A relay (5V DC coil), a BC337 NPN transistor, a diode, and 1K resistor. Essentially, the transistor is used to energise the relay`s coil with the required voltage and current. A relay will often have 3 significant voltage/current ratings specified; coil, AC load, and DC load. The most important to our circuit is the coil rating, which is the current at a specified voltage required to energise the coil (activate the switch), sometimes expressed as milliwatts (mW). The AC and DC load ratings relate to the switch-contacts, and state the maximum load current (e. g. for your lamp, motor, etc. ) that can be carried at the given AC and DC voltages. DC loads are rated lower because they arc (spark) more, which eventually wears the contacts to the point of failure. In general, large loads need heavier contacts, which in turn need bigger coils to...

Leave Comment

characters left:

Related Circuits

  • New Circuits



    Popular Circuits

    Electronic Keypad
    ve170 monitor repair with led
    max2338 hp at the sound amplifier
    Timer circuit
    No Comment Added
    uart interfacing with blackfin tyro
    Metal detector circuit diagram 8
    A Low-Frequency Crystal Controlled Oscillator