Solenoids
Solenoids are basically electromagnets. Send current through it, and it becomes a magnet. Add an iron core in the shape of a piston, and you have a little actuator that pops the piston out/in when activated. Because they can be quite expensive, and you definitely will require a wall-wart transformer, your kit does not include it. They can be found at local electronics supply stores or online.
Depending on their size, solenoids draw a lot of current (>2A) when active, so bear that in mind if you want to keep a solenoid engaged for a long time. These can be use to push buttons, tap tuned plates, or pull very short distances (typically <2cm). There are also latching solenoids that ‘stick’ between the on/off state, those won't be good for tapping, but are meant for say fluid control valves.
In this recipe we are using the N-Drive MOSFET and a plain button to turn the solenoid on/off. Notice how the N-Drive MOSFET can be used to toggle various different high-powered circuits.
Notice how in this example we are using the 4xAA battery pack to power only the Photon; in this case 6V goes only to the Photon, and the solenoid itself is powered from the 12V/3A power supply via the MOSFET.
What type of sensor can you use to replace the button? For starters, basic sensors that report a simple ON/OFF state will be great. Examples include the PIR movement sensor, or the piezo vibration sensor.
Libraries Used
(learn how to import them in the Build IDE):
- none
Code
|
|