Diodes are commonly used discrete semiconductor device. It has many uses and purposes. Its operation is based on PN semiconductor junction characteristics. Depending on diode physical and chemical properties it can behave very differently. Together with other electronics components diode can be used for voltage clipping, multiplying, rectifying, signal, demodulation, protection and even more. Elektro-labs have written pretty nice review of diode types and their common uses.
Simplest and probably most recognizable is regular diode which is used in switching, protection rectification circuits. Another common diode type is Zener which is used for voltage stabilization, then list goes on LEDs and photo-diodes and finishes with more exotic ones – tunneling diodes and varactors.
On battery operated circuits you simply need a simple way to test the voltage. In other hand complicated circuits don’t look very attractive. So for keeping things simple and low cost, Einar Abell suggests his single transistor voltage indicator circuit. It is able to detect transition between two voltage levels on battery.
Simply speaking, if circuit is powered from 9V battery, then it will transition from green to red indicator when voltage foes from 7.1V to 5.8V. One downside of this indicator is that it drains about 1mA of current. For any battery this is nearly not acceptable. To avoid constant drainage simply drop a push button to test voltage when you need.
If you need to keep relay turned on or off for a long time, then standard relays may not be best solution. First of all in order to keep relay switched, power must be applied. If you are using mechanical relay, then coil must be constantly energized. This way relay draws power and for battery operated equipment this is not acceptable. SSR relays might be a better solution, but signal still need to be applied in order to keep it turned on. In such cases there are latching relays used. These relays keep their state after switched and power is removed. They are common where relay need to be on or off for long time.
Controlling such relays is a bit trickier than regular ones. First of all relay can be turned on and of by changing current direction on the coil. One of solution could be H-bridge as for DC motor. But this is not very efficient and economical solution because relay doesn’t require constant current flow. It works with pulses. Normally there are special IC’s for controlling latching relays that work in push-pull mode where charge is directed from external capacitor from or towards coil. Kerry D. Wong demonstrates how one of four half-bridges of SN754410 can be used to drive such relay. So with single H-bridge IC you can drive four latching relays.
Many SPI tutorials use common notation of bus design where each device is directly in parallel connected to SCK, MISO, MOSI and CS lines. This normally works without problem, but in general, there can be problems when more than one SPI device is on the bus. DorkbotPDX rises several issues that can occur on poor design. Here are three suggestions for better SPI improvements:
- Use pullup resistors on all chip select signals.
- Verify tri-state behavior on MISO: use a tri-state buffer chip if necessary.
- Protect bus access with SPI.beginTransaction(settings) and SPI.endTransaction().
Pull up resistor helps to prevent response from multiple devices at once. This might come from poor software design when CS pins aren’t initialized properly. Second problem is with MISO pin. In fact some SPI devices doesn’t enter tri-state even when CS is pulled high. So when talking to other SPI device this will cause failures. Be sure to check if SPI device supports tri-state when inactive, otherwise add external tri-state buffer like 74AHC1G125. And last thing is SPI transactions. In systems where multiple SPI devices are used there is a risk to use different settings that were selected on different device and most importantly transactions can ensure exclusive use of SPI bus when needed.
Indeed, with Arduino declared simplicity most of us are getting lazy to dig deeper in to dangers that might await in obvious places. So always do your homework before building another schematic and don’t assume that things will work out of box every time. And this does not only apply to SPI.