Silicon ChipMotion-sensing 12V Power Switch - February 2019 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Beware of dodgy and counterfeit electronics
  4. Feature: Medical, Health and First Aid Smartphone Apps - Part 1 by Dr David Maddison
  5. Project: Versatile Trailing Edge Dimmer with Touch Plate & IR by John Clarke
  6. Review: Rigol’s MSO5354 Mixed Signal Oscilloscope by Tim Blythman
  7. Feature: El Cheapo Modules 22: Stepper Motor Drivers by Jim Rowe
  8. Project: Motion-sensing 12V Power Switch by Nicholas Vinen
  9. Product Showcase
  10. Serviceman's Log: (What) were the designers thinking? by Dave Thompson
  11. Project: USB Mouse and Keyboard Interface for Micros by Tim Blythman
  12. Project: Build-it-yourself DAB+/FM/AM radio by Duraid Madina & Nicholas Vinen
  13. Review: Philips “Brilliance” Ultrawide Monitor by Nicholas Vinen
  14. Vintage Radio: 1970s BWD 216 Hybrid Bench Supply by Ian Batty
  15. PartShop
  16. Subscriptions
  17. Market Centre
  18. Advertising Index
  19. Notes & Errata: Isolated Serial Link, January 2019; 800W(+) UPS, May-July 2018; Full Wave, 230V Universal Motor Speed Controller, March 2018; BackPack Touchscreen DDS Signal Generator, April 2017; SC200 Audio Amplifier, January-March 2017; 12AX7 Valve Audio Preamplifier, November 2003
  20. Outer Back Cover

This is only a preview of the February 2019 issue of Silicon Chip.

You can view 47 of the 112 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Articles in this series:
  • Medical, Health and First Aid Smartphone Apps - Part 1 (February 2019)
  • Medical, Health and First Aid Smartphone Apps - Part 1 (February 2019)
  • Medical, Health and First Aid Smartphone Apps – Part 2 (March 2019)
  • Medical, Health and First Aid Smartphone Apps – Part 2 (March 2019)
Items relevant to "Versatile Trailing Edge Dimmer with Touch Plate & IR ":
  • Touch and IR Remote Control Trailing Edge Dimmer Main PCB [10111191] (AUD $10.00)
  • Touch and IR Remote Control Trailing Edge Dimmer Mounting PCB [10111192] (AUD $10.00)
  • Touch and IR Remote Control Trailing Edge Dimmer Extension PCB [10111193] (AUD $10.00)
  • PIC12F617-I/P programmed for the Touch and IR Remote Control Trailing Edge Dimmer [1011119B.HEX] (Programmed Microcontroller, AUD $10.00)
  • Hard-to-get parts for the Touch and IR Remote Control Trailing Edge Dimmer (Component, AUD $20.00)
  • Infrared receiver parts for the Touch and IR Remote Control Trailing Edge Dimmer (Component, AUD $12.50)
  • Firmware (ASM and HEX) files for the Touch and IR Remote Control Trailing Edge Dimmer [1011119A.HEX] (Software, Free)
  • Touch and IR Remote Control Trailing Edge Dimmer PCB patterns (PDF download) [10111191-3] (Free)
  • Warning label for the Touch and IR Remote Control Trailing Edge Dimmer (PDF download) (Panel Artwork, Free)
Articles in this series:
  • Versatile Trailing Edge Dimmer with Touch Plate & IR (February 2019)
  • Versatile Trailing Edge Dimmer with Touch Plate & IR (February 2019)
  • Versatile Trailing Edge Dimmer – Part 2 (March 2019)
  • Versatile Trailing Edge Dimmer – Part 2 (March 2019)
Items relevant to "El Cheapo Modules 22: Stepper Motor Drivers":
  • Sample code for El Cheapo Modules 22 - Stepper Motor Drivers (Software, Free)
Articles in this series:
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • A Gesture Recognition Module (March 2022)
  • A Gesture Recognition Module (March 2022)
  • Air Quality Sensors (May 2022)
  • Air Quality Sensors (May 2022)
  • MOS Air Quality Sensors (June 2022)
  • MOS Air Quality Sensors (June 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Heart Rate Sensor Module (February 2023)
  • Heart Rate Sensor Module (February 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • VL6180X Rangefinding Module (July 2023)
  • VL6180X Rangefinding Module (July 2023)
  • pH Meter Module (September 2023)
  • pH Meter Module (September 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 1-24V USB Power Supply (October 2024)
  • 1-24V USB Power Supply (October 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
Items relevant to "Motion-sensing 12V Power Switch":
  • Motion-Sensing 12V Power Switch SMD PCB [05102191] (AUD $2.50)
  • SW-18010P Vibration Sensor Switch (Component, AUD $1.00)
  • Short form kit for the Motion-Triggered 12V Switch (Component, AUD $10.00)
  • Motion-Sensing 12V Power Switch SMD PCB pattern (PDF download) [05102191] (Free)
Items relevant to "USB Mouse and Keyboard Interface for Micros":
  • USB Mouse and Keyboard Interface PCB [24311181] (AUD $5.00)
  • PIC32MX270F256B-50I/SP programmed for the USB Mouse and Keyboard Interface for Micros [2431118A/B.HEX] (Programmed Microcontroller, AUD $15.00)
  • MCP1700 3.3V LDO (TO-92) (Component, AUD $2.00)
  • Software for the USB Mouse and Keyboard Interface for Micros [2431118A.HEX] (Free)
  • USB Mouse and Keyboard Interface PCB pattern (PDF download) [24311181] (Free)
Items relevant to "Build-it-yourself DAB+/FM/AM radio":
  • DAB+/FM/AM Radio main PCB [06112181] (AUD $15.00)
  • Dual Horizontal PCB-mounting RCA sockets (white/red) [RCA-210] (Component, AUD $2.50)
  • PCB-mount right-angle SMA socket (Component, AUD $3.00)
  • 465mm extendable VHF whip antenna with SMA connector (Component, AUD $10.00)
  • 700mm extendable VHF whip antenna with SMA connector (Component, AUD $15.00)
  • PCB-mount right-angle PAL socket (Component, AUD $5.00)
  • Short Form Kit for the Micromite Plus Explore 100 (Component, AUD $75.00)
  • Case pieces for the DAB+/FM/AM Tuner (PCB, AUD $20.00)
  • Firmware (BAS and HEX) files for the DAB+/FM/AM Radio project (Software, Free)
  • DAB+/FM/AM Radio main PCB pattern (PDF download) [06112181 RevC] (Free)
Articles in this series:
  • DAB+ Tuner with FM & AM and a touchscreen interface! (January 2019)
  • DAB+ Tuner with FM & AM and a touchscreen interface! (January 2019)
  • Build-it-yourself DAB+/FM/AM radio (February 2019)
  • Build-it-yourself DAB+/FM/AM radio (February 2019)
  • Our new DAB+ Tuner with FM and AM – Part 3 (March 2019)
  • Our new DAB+ Tuner with FM and AM – Part 3 (March 2019)

Purchase a printed copy of this issue for $10.00.

Motion-Triggered 12V Switch This simple circuit switches on a 12V circuit when it detects acceleration or vibration. It has many possible uses but it’s especially handy if you have an always-on car accessory power socket. These are becoming quite common but they make it rather difficult to use a standard dashcam or GPS. This project solves that problem and it can be built in a couple of hours. by Nicholas Vinen T his solves a problem that shouldn’t exist – but it does, and it’s really annoying. While it has many different potential uses, I designed it specifically to switch a dash-mounted video camera (“dashcam”) on automatically when you start driving the car, then off again when you stop. But, you are wondering, don’t dashcams already do that? Aren’t they powered on and off automatically as the accessory socket switches on and off with the vehicle ignition? Of course they are… in most cases. The problem But for whatever reason, the accessory power socket (“cigarette lighter”) in my wife’s car does not switch on and off with the ignition. Since it’s always on, after driving, her dashcam runs until the car’s battery is almost flat, at which point the accessory power socket shuts off. As if that wasn’t annoying enough, when (if!) you start the car the next time, it doesn’t come back on automatically. You have to remember to unplug and re-plug the dashcam to get it to go on. Somehow, I doubt we are the only people with this problem. Obviously, this is not very satisfactory. I guess the power socket remains on so you can charge your phone (or run other accessories) with the ignition off. But I think this “feature” causes more problems than it solves. And while the socket is no doubt under the control of the body computer, I can’t find any way to set it back to the old-fashioned scheme – which worked fine, thank you very much. There’s no obvious physical or software switch to do so. Hence, I had to come up with this project as a way to switch the dashcam on and off automatically, while drawing very little power when it is off, so the vehicle’s battery still has a reasonable charge after sitting for a few days. The solution The obvious solution was to sense when the car is running via the battery It’s a problem that shouldn’t exist . . . but it does if your cigarette lighter socket doesn’t power off when the ignition is off! 48 Silicon Chip Australia’s electronics magazine siliconchip.com.au Q2 IRF4 9 05 S CON1 S1 S2 100 µF LL ZD1 15V 10M + 12V IN 820k – E 820k SC 2019 + 12V OUT –  LED1 BC547 ZD1 B K CON2 10k Q1 BC547 LL: LOW LEAKAGE A G A C B 100nF D K G E C D D S Fig.1 (left): the circuit diagram for the version of the circuit which uses a P-channel Mosfet (Q2). It has the advantage that the incoming and outgoing ground connections are continuous – power is interrupted on the positive side only. Vibration or motion cause S1 to discharge the 100uF capacitor, which switches on Q1 and then Q2 and gives a five-minute time delay before they switch off again if S1 is not triggered in the meantime. IRF4905 MOTION SENSING 12V SWITCH (P-CH) Fig.2 (right): this version of the circuit uses an N-channel Mosfet for Q2 instead. If you compare it to Fig.1, you can see that the changes essentially involve flipping everything upside-down to deal with the different gate drive polarity requirement of this Mosfet. Otherwise, it works the same, except for the fact that it breaks the ground connection between the input and output side to switch the connected device(s) off. 12V IN 10k E Q1 BC557 B 820k S2 100 µF LL ZD1 15V 10M 12V OUT – A D BC557 ZD1 B K Q2 IRF540N G S LL: LOW LEAKAGE A  LED1 K S1 CON2 + C – SC siliconchip.com.au 820k + 2019 voltage. But another “feature” of this otherwise fine vehicle is that it doesn’t always charge the battery while running, So I had to find another way. My next idea was to have an accelerometer that’s monitored by a lowpower microcontroller, waiting for the vehicle to move before switching on power to the dashcam. It could then leave the power on as long as the vehicle was in motion (with a timer, so it doesn’t go off when you’re stationary for a couple of minutes at a time), and switch it off at the end of the trip. But I realised that I was over-complicating matters. There is a much simpler solution – using a vibration switch. These small, low-cost devices consist of a spring surrounding a metal post inside a can. At rest, the spring doesn’t touch the post but any movement or vibration causes it to come into contact, closing the switch contacts. Less sensitive versions use stiffer springs. So it’s just a matter of using that switch to trigger a separate device to switch 12V power to the dashcam, and adding a timer to delay switch-off. 100nF CON1 E G C D D S IRF540 MOTION SENSING 12V SWITCH (N-CH) The design presented here uses just nine (mandatory) components, plus the accessory plug and socket, to achieve that. That’s certainly a lot simpler than the accelerometer-based solution would have been! I set the time-out period to about five minutes. Even in the worst traffic, you usually are not stationary for that long. Circuit description Refer now to the circuit diagram shown in Fig.1. This uses a P-channel Mosfet as the switch (Q2) so that it’s the +12V line which is switched. The heart of the project is one of these tiny vibration switches, shown with a $2 coin for a size reference (and they don’t cost much more than $2 anyway!) On the left is the Soyo SW1801P from Pakronics; on the right is the CM1800-1 from element14. Australia’s electronics magazine The ground connection is unbroken. This may be important in some cases, where your dashcam might connect elsewhere in the vehicle and could have a separate ground connection to the chassis. In that case, switching the negative end of the power supply wouldn’t do anything useful. The 100µF capacitor provides the five-minute delay, in combination with the two 820kresistors between its negative end and ground. Initially, when power is applied, the 100µF capacitor is discharged. That means that current flows through it and the upper 820kresistor, to the base of NPN transistor Q1, as it charges. Q1 therefore switches on, pulling the gate of Mosfet Q2 low, close to 0V. As a result, Q2’s channel conducts current from the 12V positive input to the 12V positive output, powering the dashcam. As the 100µF capacitor charges, after about five minutes, the base of Q1 drops below about 0.5V. Q1 then begins to switch off, allowing the gate of Q2 to be pulled up to +12V by the 10Mresistor, switching Q2 off. The reason we do not have the caFebruary 2019  49 820k + 100 µF S1 CUT HERE 10k Q2 NOTE: VIEW OF BOTH BOARDS IS FROM THE TOP (COMPONENT) SIDE, AS WE NORMALLY SHOW WITH PCB LAYOUTS. THE COPPER STRIPS ARE ON THE UNDERSIDE OF THE BOARD, AS IF YOU WERE LOOKING THROUGH THE BOARD WITH X-RAY VISION. 100 µF 12V IN LED1 + 820k 820k CUT HERE CUT HERE S1 Q1 100nF Q2 10k 12V OUT 10M ZD1 12V IN LED1 Q1 820k 10M ZD1 100nF 12V OUT Fig.3: use this diagram as a guide to building the P-channel version of the circuit on a piece of stripboard. Note carefully the two locations where the tracks are broken, with a knife or drill. Watch out to avoid the possibility of component leads or exposed metal tabs shorting to each other if the components are moved slightly. Fig.4: this is the stripboard layout for the N-channel version of the circuit. As with the circuit diagram, this is basically just a flipped version of Fig.3 to compensate for the difference in behaviour between an N-channel and P-channel Mosfet. pacitor directly on the gate of Q2 is that that would cause Q2 to switch off slowly, over about 30 seconds, due to the slow charging rate of that capacitor. During this time, the Mosfet would be in partial conduction and so it would have a high dissipation, heating up and possibly burning out. Since Q1 is a bipolar junction transistor, and its load impedance is so high, it only takes a few millivolts of change in its base voltage to go from fully on to fully off. That, in turn, allows Q2 to switch off fast, typically spending less than one second in partial conduction, so it doesn’t heat up too much during switch-off. The 100µF capacitor needs to be a low leakage type due to the high charging impedance of 820k+ 820k= 1.64M. Otherwise, it will never fully charge and so Q2 may never switch off. Alternatively you can use two 47µF tantalum capacitors in parallel (as we did on our prototype) although a low-leakage electrolytic will probably be cheaper. ZD1 protects the gate of Q2 from excessive voltages, which may be due to power supply spikes in the system. It clamps the gate to around +16V and -1V, well within its ±20V rating. The current through ZD1 is limited by the relatively high base impedance of Q1. The maximum base current with a 14.4V supply is (14.4V – 0.5V) ÷ 820k = 17µA. The highest beta for a BC547 is around 800 at 2mA but it’s less than half that at very low currents, so the maximum figure is around 400. That translates into a collector current of no more than 17µA x 400 = 6.8mA. That’s more than enough current to pull the gate of Q2 to 0V but low enough that neither Q1 nor ZD1 will be damaged if the supply voltage is high enough for ZD1 to conduct. Even if the supply voltage is considerably higher (which it would need to be, for ZD1 to conduct), nothing is going to burn out. The 100nF capacitor between the base and emitter of Q1 is important since the supply voltage in a vehicle can vary a great deal, from around 10V when cranking up to around 14.4V when the battery is being charged. And there can also be a great deal of noise and some significant voltage spikes on the supply line. This 100nF capacitor prevents supply spikes from causing Q1 to switch off briefly, which would cut power to the dashcam. Optional components Pushbutton switch S2 is shown wired across the vibration switch, as a manual means of forcing the unit to switch on. But you will notice that we have left it out of our PCB designs. That’s because merely bumping the PCB is enough to switch the unit on; so it would probably come on even before you could press S2. So while it makes sense in theory, in practice, you don’t need it. LED1 and its 10kcurrent-limiting resistor are wired across the output so you can easily see if the unit’s output is switched on. This only adds about 1mA to the current consumption when the unit is on. It’s handy for debugging and testing, but you don’t need it, so you could leave it off your version. By the way, the circuit draws almost no power when off – basically just the leakage current of the 100µF capacitor, which is usually around 1µA. So it will not affect your vehicle’s battery life. The vehicle itself will typically draw around 10mA, plus another 10mA or so of battery self-discharge, for a total of around 20mA which is 20,000 times more than this circuit draws. Alternative versions Fig.2 shows how you can build the circuit using an Nchannel Mosfet instead of a P-channel Mosfet. Essentially, everything is inverted. Q1 changes from an NPN transistor to a PNP transistor. All the other parts are the same, just connected differently. You might want to build this version just because it’s 12V IN 820k 47F 47 F 47F 47 F 10M SAIA SW-18010P S1 This photo is taken from the opposite side of the stripboard than the diagram above (ie, output on left and input on right) to more clearly show the smaller components which could be otherwise hidden. 50 Silicon Chip Q2 ZD1 Q1 10k LED1 12V K OUT 820k 100nF Fig.5: the PCB overlay for the SMD version of Fig.1, the P-channel version of the circuit. It is slightly taller but it is narrower and much thinner, so it should give a more compact result. Mosfet Q2 is in an 8-pin SOIC package which is easy to solder, as are all the other components. Note the two 47µµF capacitors connected in parallel, which are used instead of a single 100µµF capacitor which would be larger. Australia’s electronics magazine siliconchip.com.au easier and cheaper to get a high-current N-channel Mosfet. You may even have one lying around somewhere. But keep in mind that it interrupts the negative power connection, rather than the positive connection, meaning you can only really use it to switch devices which do not connect to any other powered devices (unless they get their power from the same socket). As there are so few components in this circuit, I built mine on stripboard (or “Veroboard”) and you could do the same. The stripboard component layouts are shown in Figs.3 and 4. SMD PCB version However, many people don’t like stripboard (to be honest, I’m normally one of them!), so I also designed a small PCB for the P-channel version only. This uses SMD parts (see Fig.5) so has the advantage of being much shorter and thinner, at just 25 x 20 x 5mm. It’s therefore suitable for encapsulation in a smaller (~16mm diameter) piece of heatshrink tubing, making it easy to tuck away. The only through-hole part used is the vibration sensor itself, S1. This is laid on its side and held down to the board using a couple of wire straps to keep everything nice and rigid, minimising the overall size of the module. The only difference in the circuit is that we’ve used two parallel 47µF 16V SMD ceramic capacitors rather than a single 100µF electrolytic, as 100µF 16V SMD capacitors tend to be larger and more expensive. In addition to being compact, ceramic capacitors are very reliable and heattolerant compared to electrolytics. We won’t go into any great details regarding the assembly of the SMD version, although we have an alternative SMD parts list at right. If you want to build this version, you can purchase the short form kit (which includes the PCB and all on-board parts) from our online shop (Cat SC4851). Solder them in place where shown in Fig.5. Construction One critical aspect of construction is to note that one of the leads of the vibration sensor may be extremely thin and easy to break. It depends on exactly which sensor you use; we used a very common type (SW-18010P) and managed to break one lead while testing it. Interestingly, the other lead is really thick and presumably intended to allow it to be rigidly mounted to the board. The layout for the P-channel version that I built is shown in Fig.3, with the layout for the N-channel version in Fig.4. As with the circuits, they are almost a mirror-image of each other. Both designs require tracks to be cut in two places; the cuts are shown on either side of Q2. Look closely at Fig.3 and Fig.4; the breaks are shown but they are visually subtle. You can make these cuts with a sharp knife but make sure you remove a fair bit of copper so they can’t accidentally come in contact. Some people prefer to use a ~4mm drill turned by hand but it needs to be sharp or it will not cut the copper. It probably wouldn’t hurt if you actually drilled through the board but might weaken it slightly. Having made the two track cuts, fit the components. siliconchip.com.au Parts list – 12V movement/vibration switch P-channel version on strip board 1 piece of stripboard/Veroboard, five strips x 14 holes 1 Soyo SW-18010P vibration sensor, or similar (S1) 1 car accessory power extension cable, length to suit (cut in half to get cables with plug and socket on ends) short lengths of various diameter heatshrink tubing Semiconductors 1 BC547 NPN transistor (Q1) 1 IRF4905 P-channel Mosfet or equivalent (Q2) 1 blue 3mm LED (LED1 1 15V 0.4W or 1W zener diode (ZD1) Capacitors 1 100µF 16V/25V low-leakage electrolytic or 2 47µF 16V tantalum 1 100nF ceramic Resistors (all 0.25W, 1% or 5%) 1 10M (brown black green brown or brown black black yellow brown) 2 820k (grey red yellow brown or grey red black range brown) 1 10k (brown black orange brown or brown black black red brown) Parts substitutions for N-channel version 1 BC557 PNP transistor (Q1) 1 IRF540N N-channel Mosfet or equivalent (Q2) Parts for SMD version on PCB* 1 double-sided PCB, coded 05102191, 25.4 x 19.5mm 1 Soyo SW-18010P vibration sensor, or similar (S1) 1 car accessory power extension cable Semiconductors 1 AO4421 P-channel Mosfet or equivalent, SOIC-8 (Q1) 1 BC847 NPN transistor, SOT-32 (Q2) 1 blue 3216/1206 LED (LED1) 1 15V 0.25W zener diode, SOT-23 (ZD1) Capacitors 2 47µF 16V X5R ceramic, SMD 3226/1210 package 1 100nF 50V X7R ceramic, SMD 3216/1206 package Resistors (all SMD 3216/1206 package, 1%) 1 10M 2 820k 1 10k *Where to get the SMD short-form kit: (Includes PCB and all on-board parts): Cat SC4851 from the SILICON CHIP ONLINE SHOP (siliconchip.com.au/shop) Where to get the vibration sensor: The SILICON CHIP ONLINE SHOP stocks the SW-18010P for $1 each (Cat SC4852). Our standard $10 p&p charge per order applies – it pays to order several things at once! Pakronics (www.pakronics.com.au) have two Vibration Sensors in stock: the recommended Soyo SW-1801 P (Cat ADA1766), described as “easy to trigger”, plus a “hard to trigger (ie, less sensitive) Cat ADA 1767. Both are priced at $3.36 plus GST and freight. Alternatively, element14 (au.element14.com) has a range of slightly different “Comus” vibration switches (Cat 607253 and 540626) which could also be used in this project. Both are priced at $4.06 plus GST and freight. (These sensors are the ones in the photo on page 49 – the Soyo SW-18010P on the left and the Comus [element14] on the right.) Australia’s electronics magazine February 2019  51 The axial components (reshould go out and the voltsistors and zener diodes) are age across the safety resistor all mounted with their leads should drop to no more than 0.2” or 5.08mm apart, so they a few millivolts. will need to have their leads When LED1 goes out, give bent so that they sit on the the board a tap. The LED board in a semi-vertical poshould switch back on. If it sition. does, everything looks good. You have a choice of which If LED1 doesn’t go out, or side to place the component Unfortunately we didn’t have any clear heatshrink large it doesn’t go back one when body; try to orientate them enough – so red had to do! If there is any danger of any you tap the board, check it to avoid the possibility of component being shorted (remember there’s lots of movement carefully for short circuits. component leads shorting to- under a dashboard) we’d also be inclined to crimp the edges It’s easy to accidentally short of the heatshrink together before shrinking it. gether. adjacent tracks on stripboard. Make sure that the cathode stripe of ZD1 faces in the It could also be due to a leaky electrolytic capacitor. correct direction, as shown in Fig.3 and Fig.4. Use a DMM set to measure ohms and probe adjacent The radial components (electrolytic capacitor, sensor, tracks. If you get a reading lower than 10W, chances are LED) have their leads soldered to adjacent tracks, 0.1” or you have a short circuit. 2.54mm apart, and this should be the natural pin spacing Also check your component placement and orientation, of these parts, making it easy. using Fig.3 or Fig.4 as a reference. Watch the orientation of the electrolytic capacitor; its If it’s working, remove the safety resistor and power the positive lead is longer and should be located where shown circuit directly from 12V. Measure the voltage at the socket. with the + symbol in Fig.3 or Fig.4. You should get a reading of +12V with the red probe touchSimilarly, you will probably not need to bend the leads ing the small contact area inside the base of the socket and of Q1 or Q2 as they will likely already have the requisite the black probe on the inner metal surround. 0.1-inch spacing. Watch the orientation of both parts. You can then try plugging a vehicle accessory such as The orientation of the vibration sensor doesn’t matter dashcam or GPS into the socket and check that it powers since it just acts as a switch. up correctly. Wiring it up Finishing it off With all the components on the board, now you just need to wire up the plug and socket. Rather than purchase a vehicle accessory (cigarette lighter) plug and socket separately, I bought a Jaycar Cat PP2006 “cigarette lighter double adaptor”. I then simply opened up the plug (undoing one screw and unscrewing the tip), removed the contacts, de-soldered the wires and pulled them through the strain-relief boot. That gave me two pre-wired sockets plus a plug, which I put aside since I already had a pre-wired accessory plug (Jaycar Cat PP1995). The PP1995 plug wires went straight into the stripboard holes and I soldered them to the tracks, although I found I had to add some flux paste as I had difficulty getting the wires to take solder. I had to drill the board holes for the socket wires out to 1.5mm so after pushing the wires through the holes, I bent them over to come in contact with the copper strips and soldered them in place. Assuming all is well, disconnect everything and add some heatshrink insulation. It’s a good idea to slip some tubing over the TO-220 package and shrink it down to ensure it can’t short against any adjacent components. Do the same with any other components you think could short if they move or are bent. Then slide larger diameter clear heatshrink tubing over the cigarette lighter plug and onto the board and shrink it down, so it can’t short against any exposed metal that may be in the vehicle, or loose items like keys. Installing it in the vehicle is simple. Just plug it into the accessory socket, plug in your dashcam, GPS or whatever, then find somewhere to tuck the circuit board away. It would be a good idea (at least initially) to put it somewhere where you can observe LED1, ideally from outside the vehicle, through a window. Leave it for 5-10 minutes, somewhere where the vehicle is not going to be rocked by vehicles passing at high speeds, trucks, etc. Then check to see if LED1 has gone out. If it has, open the door and get in. The motion from doing so will probably trigger the unit and switch LED1 back on. Otherwise, give the board a little nudge and check that it switches back on. You may find the unit is too sensitive, eg, passing traffic often triggers it. In this case, you have two main options. The easiest is to add some cushioning around it like foam, to reduce the amount of movement and vibration transferred to it, reducing its sensitivity. You will need to experiment with the type and thickness of material to achieve a good result. If that’s no good, you will have to remove the vibration sensor and fit a less sensitive version. But we’ve found that they are usually too insensitive so SC you’re better off with the foam. Testing Ideally, testing should be done with a current-limited 12V DC supply in case there is a short circuit on the board, or one component has been installed incorrectly. This can easily be achieved by connecting a 1005W or 2201W resistor in series with the supply. You can monitor the voltage across this resistor to get an idea of the circuit’s current draw. You can connect the supply to the cigarette lighter plug using a couple of alligator clip leads. LED1 should light up immediately and you should get a reading of around 0.1-0.2V across the resistor due to the 1mA used to light it. If you leave board alone for about five minutes, being careful not to touch or bump it, LED1 52 Silicon Chip Australia’s electronics magazine siliconchip.com.au