Приказивање постова са ознаком temperature. Прикажи све постове
Приказивање постова са ознаком temperature. Прикажи све постове

недеља, 26. новембар 2017.

More sensors

This is a followup of my previous post.
I have managed to integrate multiple sensors into a single system capable of sensing if the entrance door is locked/unlocked, if there is a motion inside the apartment and to record the temperature and humidity.
It all started with the status of the entrance door. I wanted a system capable of sensing the status of the lock, but to be able to work without any electrical contacts, since it may corrupt the sensor in time. So I have found an inductive (contactless) switch and I have placed it in the entrance door of my apartment. It is connected to one of my raspberry pi computers, and it sends the information about the state of the door lock to my main server.
The Pi is glued to the wall next to the door:
You may wonder why are the headphones attached to the Pi. They emit the annoying sound of sine waveform, frequency of 3000Hz when the door is unlocked for more than one minute. That way I have a reminder that I need to lock the door.
The red LED is an indicator of the door lock status. If it is red, the door is locked. However, going to the door to see if it is locked or unlocked is not too attractive. I had to invent some way to know the door status without actually going to the door. That is why I have developed the Android application for it:
The lock icon goes red when the door is locked (the time is written below the icon), and goes green when the door is unlocked. The notification comes in real time thanks to the Google Cloud Messaging.
Next came the web portal. I wanted to have the history of door locking and unlocking. That is how I made this web page:

The red cell in the table indicates that there was some motion detected after the door has been locked. This is the proper introduction for the motion detection sensors: after adding door lock and temperature sensors, I wanted to add motion detection sensors inside the apartment. I have used HC SR-501 PIR motion detector:
I have three sensors placed around the apartment and I have a web page which updates the motion information in real time (WebSockets used):

Let us not forget the temperature and humidity sensors:


недеља, 2. јул 2017.

Home weather net

There is a followup of this post.
When I purchased Raspberry Pi starter kit couple of years ago, I got the DS18B20 sensor with it. It is a simple device, three pins only, uses one-wire protocol to send the measured temperature to the host computer. There are plenty of tutorials how to use it with the Raspberry Pi. 

I have connected that one sensor to the PI and was able to read the temperature.

Then I have purchased more DS18B20 sensors and placed one outside, in the shadow.


Then I have purchased DHT11 combined sensor for both temperature and humidity.

DHT11 sensor has a nice support for Python in this library.

Now I have four sensors, two for the inside temperature, one for the outside temperature, and one for the inside humidity. The next step was to make some web site for temperature reading. I have created a small web server which gathers data from all four sensors and displays it in two ways: gauges and charts:
This is nice, but I wanted an instant readout of the temperature, without a need for grabbing the nearest mobile phone, tablet, or computer and navigating to the web server. Then I remembered that I have two old Samsung Android phones: Samsung Galaxy Ace and Samsung Galaxy S+. Both have old Andorid OS, v2.3.6. Both have so small amount of RAM, that they are useless now (especially the Galaxy Ace). So, I have uninstalled everything and installed my own custom application, so those phones now have a new purpose:



Whenever I look at them, they display the time, date, and the temperature inside and outside. The data is displayed each second, moved to the right by one pixel, and then at the end of the line, moved by one pixel below, so the pixels are not burned.

Android phone runs without battery

Now I had two questions: will the display live, since I have turned off the screen saver, and what about the battery - can I run the mobile phone without a battery?

Well, the first question can be answered only by the experiment, and both phones now work for approximately half a year, and they still work.

The second question is more interesting: if I remove the battery, the phone will not work. Android is designed to work with the battery, and it needs software patches at very low level to turn off the protection which requires the battery to be present.

Now, there are plenty of tutorials how to make your Android phone work without a battery. Those tutorials work for older devices like these I have. It all comes to one thing: pretend that you do have a battery. How to do that? Here is what I have done.

First of all, the procedure differes for various phones. Even my two phones have different procedure. For the Galaxy Ace, it was the simple one. There are three pins inside the phone to which battery contacts connect when you insert the battery.

You can connect 5V (from the charger) to the plus pin, ground to the minus pin, and, for the Galaxy Ace, I simply shorted the 'B' pin to the minus pin. The battery voltage is 3.7V, but the phone works with 5V, too.


The picture above is the Galaxy Ace. No voltage regulators, and no resistors.

With the Galaxy S+, it was a different story. First of all, 5V and ground from the charger can be connected to the plus and minus pins, but the phone does not work reliably. I needed to step down the voltage. I have purchased a buck step down regulator, and lowered the voltage to 3.9V. Then I have tried various resistors between minus pin and 'B' pin, to find out that 10K Ohm resistor works nice. So, my final configuration includes voltage regulator to step down the voltage, and 10K resistor between 'B' and minus pins:


The picture above is the voltage regulator and the Galaxy S+. The resistor cannot be seen here, since it is placed inside the phone.