Central Processing Unit
When I started designing the trap I didn't know which parts I would use. I wanted to use wireless communication as I imagined the laser module and the sensor to be located in opposite parts of the room. Wifi and Bluetooth LE were two technologies I considered. I knew wifi modules used a lot of power so I began to search the net for BLE modules with GPIO capabilities. HM-10 [1] turned up frequently. A pair of HM-10 modules can connect to form a bidirectional serial data link, but we are only interested in the AT commands. When I read the specification I figured I could use the AT+PIO command to control the laser and read the state of the light sensor, although a GPIO with interrupts would have been better than constant polling. Later I found the AT+ADC command which allows the application to read the exact sensor level between 0V and 3.3V instead of just a digital 0 or 1 with a switch of value somewhere between 0.8V and 2.0V. It is handy to be able to adjust the detection level in software to be able to adapt to different light conditions. HM-10 can be set to AT+MODE1, where it can receive AT commands over the air, and not only from the wired serial port which is the default. To distinguish traps from other BLE modules nearby I decided to use the command AT+NAME and call them LASERTRAP.Power Supply
The HM-10 runs on 3.3V. It is practical to have a voltage regulator supply this voltage and not a battery directly, as it makes it possible for the trap to accept a wider range of voltages (4.8V-15V) from various sources. A low current voltage regulator is cheaper, but I also want it to be able to supply power to the laser module. I decided to use a 800mA regulator [2].Status LED
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhB_fKAUWEtqeo6eAdKNPaXOYZhF_LvaHiONoKmqNJHlz14w6_lqHQuNnJC0LBm-WtR27RaR6m_FZuMNsrUl56uitya9wHmLshf-H94_hF_k_Xr1v18L9wLE36rsl59N5aczdXJVAbzbeP9/s200/LED.jpg)
The Laser Module
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrHe2aAZd_GmGDtxY8nei70kIWGS98X-Wxul6iv9y-Ia4mnkpc45q_hgCCWCrz4otJw44FHenaRh_N8-JtVwDvp4gRdDSm4Hcc5yOS-C2GAT7MY6Z4o5BcovfjVpKJV_prev-Z387-GNan/s200/Laser.jpg)
Now I had to think about how much current PIO2 can handle before it starts to raise significantly above ground, say 0.3V. This is caused by the inner resistance Ri between the pin and the true ground. With a measured Ri = 10Ohm, PIO2 can handle 0.3V/10Ohm = 30mA. This is the maximum current the laser module is allowed to draw if it needs 3V to operate.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJPfGezrsRCCJP7n-bZumSd8avK71Yg-VNgj7vl2hdKMg5W5DjALntCmYA3wedK0uB7t2djHkMdV6SVrPPhDxMVMqPNmgkEjfveCl3H6LLWtsy5annSQDWMNnz2RvzyaSvjnkBT9l9tca6/s200/PowerLaser.jpg)
The most affordable laser module is 650nm red. Unfortunately, our eyes are only about 20% efficient at this wavelength. This means the laser beam can not be seen from all angles in a dark room with smoke or fog in the air. For best visibility the more expensive 532nm green can be used. It is visible from all angles. Somewhere in between, both for visibility and price, is the 635nm red.
The Light Sensor
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuEdDcToWWrAWBnoi9bf5EovXolQ-tLHXdRjii_gH7zNdLKSwaSLYlhMOXRzcusLwND3EtND3KH4eM7oONGMuSgZ0PMSxryTJ8Qepe5YgYv0QFaL3KYul5xWZN4Mba7agtG4rNUaq3SS-_/s200/Sensor.jpg)
The typical use case for the sensor designed above is a dark room. Normal daylight that reaches the sensor will make the resistance drop below 400Ohm and therefore make the sensor unusable under such conditions. We can make the sensor less sensitive by raising the laser detection level to 2.5V in a dark room. We will by this modification extend our headroom to also be able to work in a bright room, but at a detection level somewhere below 2.5V, as the combined light that hits the sensor will be more intense than the laser alone. The Android application will have to dynamically adjust to the correct laser detection level to be able to handle varying ambient light. R1 = 400Ohm*0.8V/2.5V = 128Ohm.
References
[1] http://www.jnhuamao.cn/Bluetooth40_en.zip[2] http://www.diodes.com/_files/datasheets/AZ1117C.pdf
[3] http://www.avagotech.com/docs/AV02-0551EN
[4] http://cache.nxp.com/documents/data_sheet/BC807_BC807W_BC327.pdf?pspll=1
[5] http://akizukidenshi.com/download/ds/senba/GL55%20Series%20Photoresistor.pdf
No comments:
Post a Comment