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.
When deploying remote electronic device there is always a dilemma how to power it. You normally want to provide long therm power source and if it can recharge during operation, then things are even better. If you are thinking on building embedded project outside, then you should consider using renewable power sources like sun and wind. SwitchDoc Labs has been working on handy platform that helps achieve a bit of power independence. Their main focus is to provide solar tracking for small solar panel which can charge batteries, power embedded boards like Raspberry Pi or Arduino, and report parameters to apps.
So called “SunAir” have everything you need to deploy independent system which takes care of tracking sun with two photo-resistors, servo motor and limit switches. Solar charge controller ensures that proper backup battery recharge. Level booster provides 5V to power Raspberry Pi or Arduino that can monitor “SunAir” parameters and send them through network to remote app. The rest is up to you how much reliability you want. If your project is energy hungry, then add more backup battery and larger solar cells until it will be capable of sustaining itself.
In many microcontroller projects you might want to add an USB interface which is based on USB to serial converter. There are many chips available that does this job well. Most popular is FT232R or similar which is quite expensive and in some projects it can be too pricy. If you look around, you will find that there are tons of alternatives that cost cents. Ian suggests to take a look at CH340G chip which costs as little as 40 cents. Of course it comes from China market.
He purchases several of these and built eagle part so everyone could easily include in project. Since datasheet of this chip is scarce, he’s done the hard work by finding pin-outs and drawing typical schematics for 5V and 3.3V circuits.