Motion detector solenoid lol

Thread Starter

Erock12

Joined Dec 26, 2023
20
The PP3 (9V battery) is a terrible power source, particularly for high current applications like solenoids. I encourage you to consider something else. Even 6 AA cells are much, much better than the 9V. But even better than that is a rechargeable option, like LiPo or other lithium based cells.
Getting a 9v rechargeable?
 

Thread Starter

Erock12

Joined Dec 26, 2023
20
The PP3 (9V battery) is a terrible power source, particularly for high current applications like solenoids. I encourage you to consider something else. Even 6 AA cells are much, much better than the 9V. But even better than that is a rechargeable option, like LiPo or other lithium based cells.
I’m trying to keep the design small and shallow as possible, that’s why I went with a 9v.
 

Ya’akov

Joined Jan 27, 2019
10,252
I’m trying to keep the design small and shallow as possible, that’s why I went with a 9v.
The 9V battery may be small for its voltage but it is also very expensive in terms of cost per Wh. The life is short which means changing the battery a lot, and good ones are costly.

A LiPo pouch cell and a boost converter, or even two LiPo cells stacked, can compete with the compactness of the PP3 while providing more current, more capacity, and better cost per Wh.
 

Thread Starter

Erock12

Joined Dec 26, 2023
20
So I’m the tour I
The 9V battery may be small for its voltage but it is also very expensive in terms of cost per Wh. The life is short which means changing the battery a lot, and good ones are costly.

A LiPo pouch cell and a boost converter, or even two LiPo cells stacked, can compete with the compactness of the PP3 while providing more current, more capacity, and better cost per Wh.
I can stack 2 lipo single cell batteries, wired in parallel? That’ll be more effective
 

Thread Starter

Erock12

Joined Dec 26, 2023
20
The 9V battery may be small for its voltage but it is also very expensive in terms of cost per Wh. The life is short which means changing the battery a lot, and good ones are costly.

A LiPo pouch cell and a boost converter, or even two LiPo cells stacked, can compete with the compactness of the PP3 while providing more current, more capacity, and better cost per Wh.
So I’ll be able to wire the single lipo cells in parallel to create the 9v-1amp?
 

MisterBill2

Joined Jan 23, 2018
27,611
OK, now it has become clear to me that the scheme can be implemented all solid state A dual one-shot IC the MC14538, both sections connected as non-retriggerable, one section rising edge triggered, the other side falling edge triggered. The triggered "Q" output to an MPSA13 transistor to power each solenoid. The RC time constant selected for that one second pulse or whatever is finally needed. Possibly a buffer on the motion sensor output so that it delivers proper CMOS voltages. An absolute minimum parts count to deliver the specified functions, with just micro-amps idle-state current draw.
One IC, two timing resistors and two timing capacitors and two darlington transistors that do not require base series resistors. Add a power source capacitor to provide the solenoid inrush current. This circuit can easily be built up and a 1 x 2 inch perforated board: two resistors plus 2 capacitors plus one 16 pin DIP IC. And also two transistors to power the solenoids. Except that now that the current is known to be greater, a second transistor driven from the first will be required. And unlike the 555 circuit, it can perform well on 5 volts or 6 volts or 12 volts.
 
Last edited:

k1ng 1337

Joined Sep 11, 2020
1,038
Motion detected=solenoid 1 will press and release
Once no motion=solenoid 2 will press and release.
just pressing 2 buttons
This simulation triggers one solenoid on the rising edge of the input signal and the other on the falling edge. You can use a 40kHz receiver such as TSOP4838 to provide the input signal. The signal will go and stay active LOW as long as the 40kHz carrier is detected.

In lieu of the receiver circuit input signal, I am using the PULSE function to generate the signal. The simulation starts with a 3 second delay then the input signal (TRIG) goes LOW for 500ms then back HIGH and repeats every 5 seconds.

Each 555 timer is configured in monostable mode where a falling edge pulse to pin 2 initiates the lockout timer for 1.1s. This means once triggered, each output will stay on for 1.1s as set by R2 & C2.

Even though each 555 cannot retrigger during the discharge cycle, there is no hysteresis in this circuit. I can walk through how to add an infrared receiver to the circuit but a microcontroller would be better idea.

Untitled.png


Untitled1.png
 
Last edited:

MisterBill2

Joined Jan 23, 2018
27,611
It is a whole lot simpler, and uses much less power, fewer components, and real-estate, to use the dual monostable MC14538. In addition it can operate on 12 volts or 15 or 5 equally well.
So the supply can be a string of four AAA batteries and work for quite a while. The main current draw will be from the motion sensor. The MC14538 idle current is far less than the 555 current.
 
Last edited:

Ya’akov

Joined Jan 27, 2019
10,252
So I’ll be able to wire the single lipo cells in parallel to create the 9v-1amp?
Getting a 9v rechargeable?
They are equally bad and very, very expensive. They are a great alternative for old-school memory backup and other very low current applications, but you would flatten one in a very short time trying to get an amp out of it. And, it you parallel more than one, you will be using enough room for lithium, so—
 

Ya’akov

Joined Jan 27, 2019
10,252
So I’ll be able to wire the single lipo cells in parallel to create the 9v-1amp?
You can make batteries of varying voltages (adding in series) and capacities (mAh, adding in parallel). That is the meaning of xSxP (e.g.: 2S3P) in battery pack descriptors. In the case of a 2S3P pack made with typical LiPo cells, for example if we choose 800mAh cells:

\[ 2S = 2 \text{ cells in }S\text{eries} = 2\times3.7\mathsf{V} =7.4\mathsf{V}\\ 3P = 3 \text{ two cell batteries in }P\text{arallel} = 3 \times800\mathsf{h} = 2400\mathsf{mAh}\\ \text{so, the resulting battery is 7.4}\mathsf{V}\text{ 2400}\mathsf{mAH} \]
In your case, I would expect you‘d want a 2S1P or better if you can fit it a 2S2P batteries of ~500mAh capacity, and a boost converter to get the voltage up to 9V if that’s necessary and otherwise use the 7.4V—which would be better. You will also need a BMS (Battery Management System) board (sounds intense but costs a couple of bucks) designed for the configuration to manage the charging of the battery and provide some protection, and protected cells to make everything fully safe.

It may sound complicated but it really isn’t and all the bits can be found quite cheaply online.
 

k1ng 1337

Joined Sep 11, 2020
1,038
Here is the circuit adapted for a microcontroller like we discussed. I tested it on the breadboard and it works as expected with Arduino Uno. If you use another board supported by Arduino IDE, make sure to change the pin numbers.

The circuit is currently set up as a beam breaker (Emitter / Receiver Circuit) but you can swap in a PIR sensor module with a logic level output. It works like this:

1) TLC555 timer generates a 38kHz square wave lighting the infrared LED at about 15mA.

2) As you can see in the photo, the beam is normally unobstructed. During this time, TSSP4038 outputs logic LOW to GPIO3 of the microcontroller.

3) When an object blocks the beam, TSSP4038 outputs logic HIGH to GPIO3 of the microcontroller. This tells the microcontroller to run function coilA() which turns ON GPIO4 for 2 seconds. After GPIO4 goes LOW, it cannot go HIGH again until coil_A_LOCKOUT_BIT = 0.

4) When the beam is no longer blocked, TSSP4038 outputs logic LOW to GPIO3 of the microcontroller. This tells the microcontroller to run function coilB() which turns ON GPIO5 for 2 seconds. After GPIO5 goes LOW, it cannot go HIGH again until coil_B_LOCKOUT_BIT = 0.

5) The cycle repeats as the state of GPIO3 is sampled every 5 seconds.

If you look closely at the code, you'll see it oscillates turning GPIO4 ON and OFF before it can turn GPIO5 ON and OFF. If sample_INTERVAL is too low, false triggering may occur but it always follows this sequence. Feel free to ask as many questions as you like.

Untitled.png

IMG_20231228_041359791.jpg

Code:
int sensor_IN = 3; // Define pin numbers and variables
int coil_A_OUT = 4;
int coil_A_ACTIVE_TIME = 2000; // Amount of time coil_A_OUT is HIGH in milliseconds
int coil_A_LOCKOUT_BIT = 0; // Prevents coil_A_OUT from retriggering
int coil_B_OUT = 5;
int coil_B_ACTIVE_TIME = 2000; // Amount of time coil_B_OUT is HIGH in milliseconds
int coil_B_LOCKOUT_BIT = 0; // Prevents coil_B_OUT from retriggering
int sample_INTERVAL = 5000; // Time between samples in milliseconds

void setup() {
  pinMode(sensor_IN, INPUT); // Set pin modes
  pinMode(coil_A_OUT, OUTPUT);
  pinMode(coil_B_OUT, OUTPUT);
}

void loop() { // Read sensor_IN pin, turn on coilA or coilB
    delay(sample_INTERVAL);
    if (digitalRead(sensor_IN) == HIGH){
      coilA();
    }
    else {
      coilB();
   }
}

void coilA() { // Turns ON coil_A for coil_A_ACTIVE_TIME if coil_A_LOCKOUT_BIT = 0
  if (coil_A_LOCKOUT_BIT == 0) {
    coil_A_LOCKOUT_BIT = 1; // Disable coilA() function from being retriggered until coilB() function sets coil_A_LOCKOUT_BIT = 0
    digitalWrite(coil_A_OUT, HIGH);
    delay(coil_A_ACTIVE_TIME);
    digitalWrite(coil_A_OUT, LOW);
    coil_B_LOCKOUT_BIT = 0; // Enable coilB() function
  }
}

void coilB() { // Turns ON coil_B for coil_B_ACTIVE_TIME if coil_B_LOCKOUT_BIT = 0
  if (coil_B_LOCKOUT_BIT == 0) { 
    coil_B_LOCKOUT_BIT = 1; // Disable coilB() function from being retriggered until coilA() function sets coil_B_LOCKOUT_BIT = 0
    digitalWrite(coil_B_OUT, HIGH);
    delay(coil_B_ACTIVE_TIME);
    digitalWrite(coil_B_OUT, LOW);
    coil_A_LOCKOUT_BIT = 0; // Enable coilA() function
  }
}
 
Last edited:
Top