I am building a system that will turn on a computer fan for 10 S in response to vibrations. Vibration is detected with piezo electric elements mounted in . The signal is sent to a teensy that controls a 12V fan. I set a threshold to determine when the fan should turn on, It turns off after 10 sec. I have 2 questions:
1)What is the unit of threshold on teensey? On my tests I entered values such as 300 or 250
2) when I trigger the piezo, it works sometimes; sometimes not so piezo stimulation doesn't reliably turn on the fan as expected. Sometimes it turned on without obvious trigger and the piezo value read is not 0 when you don't touch the piezo but it fluctuate between 150 and 300.
Here you can find a brief explanation fo the circuit: The system consists of five piezoelectric sensors connected in parallel and placed on the floor of the cage. These sensors are connected via a BNC connector, with the red wire attached to pin A0 and the black wire connected to the ground pin of the Teensy.
The black wire from the BNC is connected in series to a 10 kΩ resistor,which is then connected in series to the ground of the Teensy; the reason is to limit the current
flowing through the circuit. The fan has two pins: the power pin (red wire) and a ground pin (black wire). The red wire is soldered to the red wire of the 12V AC adapter, while the black wire is connected to the ground of the Teensy.
Since the fan requires 12V but the Teensy supports only up to 3.3V, a MOSFET is used to control the fan. The gate of the MOSFET is connected to the PWM pin 3 of
the Teensy, the drain is connected to the fan’s black wire and the source is connected to the ground of the 12V power supply, which is also tied to the ground of the Teensy.
To ensure proper operation, a 10 kΩ pull-down resistor is placed between the gate and ground of the MOSFET. This resistor purpose is to ensure that the MOSFET remains turned off when the control signal (from the Teensy) is not actively driving the gate.
The system is controlled by a code written in Teensyduino, which monitors the piezoelectric sensors and activates the fan when a certain threshold is exceeded. You can find the script to commend the teensy attached.
1)What is the unit of threshold on teensey? On my tests I entered values such as 300 or 250
2) when I trigger the piezo, it works sometimes; sometimes not so piezo stimulation doesn't reliably turn on the fan as expected. Sometimes it turned on without obvious trigger and the piezo value read is not 0 when you don't touch the piezo but it fluctuate between 150 and 300.
Here you can find a brief explanation fo the circuit: The system consists of five piezoelectric sensors connected in parallel and placed on the floor of the cage. These sensors are connected via a BNC connector, with the red wire attached to pin A0 and the black wire connected to the ground pin of the Teensy.
The black wire from the BNC is connected in series to a 10 kΩ resistor,which is then connected in series to the ground of the Teensy; the reason is to limit the current
flowing through the circuit. The fan has two pins: the power pin (red wire) and a ground pin (black wire). The red wire is soldered to the red wire of the 12V AC adapter, while the black wire is connected to the ground of the Teensy.
Since the fan requires 12V but the Teensy supports only up to 3.3V, a MOSFET is used to control the fan. The gate of the MOSFET is connected to the PWM pin 3 of
the Teensy, the drain is connected to the fan’s black wire and the source is connected to the ground of the 12V power supply, which is also tied to the ground of the Teensy.
To ensure proper operation, a 10 kΩ pull-down resistor is placed between the gate and ground of the MOSFET. This resistor purpose is to ensure that the MOSFET remains turned off when the control signal (from the Teensy) is not actively driving the gate.
The system is controlled by a code written in Teensyduino, which monitors the piezoelectric sensors and activates the fan when a certain threshold is exceeded. You can find the script to commend the teensy attached.