FTDI_simple_alarm/README.md

70 lines
1.9 KiB
Markdown
Raw Permalink Normal View History

2020-05-11 23:08:47 +02:00
# FTDI_simple_alarm
2020-05-11 23:58:08 +02:00
Use a USB-Serial Converter like the FT232RL for activating a buzzer. Simple and cheap (~1,75€)
## Features:
* works on GNU/Linux only
2020-06-24 16:27:32 +02:00
* no drivers or other software/libs are required
* triggerd via bash or service daemon
## Limitations:
2020-05-12 08:48:48 +02:00
* works safe on system with only one `/dev/ttyUSB` device
* no other task can use the FTDI device for other things
2020-05-12 08:50:19 +02:00
## Hardware:
1. FT232RL Breakout board ~1,5€
2. NPN Transistor like 2N2222A ~0,0€
3. Active Buzzer 5V ~0,25€
### Schematics:
2020-05-11 23:54:38 +02:00
![](https://git.mosad.xyz/localhorst/FTDI_simple_alarm/raw/commit/13a1200aea0d3dfb92495ae7d7f4993ddc4338f6/img/schematics.png)
2020-05-12 08:48:48 +02:00
### FTDI EEPROM
To invert the TXD pin on the FTDI device, programming the EEPROM is needed. With the Windoofs tool "FTDI_Prog" the Template `ft232rl_alert.xml` is uplouded. For GNU/Linux is [ftx-prog](https://github.com/richardeoin/ftx-prog) available. The only difference to default is the inverted TXD pin.
## Software:
### Commmon Distributions
2020-05-12 09:14:13 +02:00
Make sure the device is after plug in recognized as ttyUSB with `dmesg`.<br/>
Edit the alert.sh with your device name, like `/dev/ttyUSB0`. <br/>
Run `bash ./alert.sh` for starting the alarm.<br/>
### openWrt
2020-05-11 23:58:08 +02:00
`opkg update`<br/>
2022-02-18 11:45:48 +01:00
`opkg install usbutils`<br/>
2020-05-11 23:58:08 +02:00
`opkg install kmod-usb-serial`<br/>
`opkg install kmod-usb-serial-ftdi`<br/>
2020-05-11 23:58:08 +02:00
Make shure the device is recocntied as ttyUSB after plug in with `dmesg`.<br/>
Edit the alarm.sh with your device name, like `/dev/ttyUSB0`. <br/>
2020-05-12 09:14:13 +02:00
Run `bash ./alert.sh` for starting the alarm.<br/>
### Service
2020-05-12 09:14:13 +02:00
`nano /etc/init.d/alarm`
```
#!/bin/sh /etc/rc.common
START=99
restart() {
bash /root/alert.sh > /dev/null 2>&1 &
bash /root/alert.sh start > /dev/null 2>&1 &
}
start() {
2020-05-12 10:44:37 +02:00
bash /root/alert.sh > /dev/null 2>&1 &
2020-05-12 09:14:13 +02:00
bash /root/alert.sh start > /dev/null 2>&1 &
}
stop() {
bash /root/alert.sh > /dev/null 2>&1 &
}
```
`chmod +x /etc/init.d/alarm`
`/etc/init.d/alarm start`
`/etc/init.d/alarm stop`