📜 ⬆️ ⬇️

We control the temperature by SMS (Arduino Nano + Neoway M660)

In my opinion, SMS is a great way to turn something on / off at a distance.
Especially the heater.
Especially in the winter.
When you want so quickly in the heat!

So, our actors:


The debugging board of the Neoway M660 GSM module was used as a GSM modem.

This is the path of least resistance, because you do not need to think about connecting the antenna and SIM-card, but it is inexpensive.

In general, the Neoway M660 is remarkable in that it has few conclusions located at the edges (a “postage stamp” type case) at a great distance from each other, so for prototyping it is the very thing.
The module is controlled via UART using AT commands ( description of AT commands M660 ).

Arduino Nano Power


Arduino Nano will be powered from a small 12 V power supply via the Vin contact.

')

Power GSM-module


After some deliberation, it was decided to power the GSM board from the Nano board via the USB connector.
The manual Neoway_M660_Module_Hardware_User_Guide says that if there is a 1000 μF capacitor in the power supply circuit, the requirement for the current source is 0.6A (at a voltage of 3.9 V).
On the M660 debug board and its USB-tail, the total is 940 uF. The AMS1117 microcircuit on the Arduino Nano board gives 5 V and 1 A to the output, the consumption of the Nano board with all the giblets and the connected temperature sensor with Vin equal to 12 V is about 24 mA. So we believe that with the power supply circuit everything is OK.

Matching UART Levels


The signal level of the Nano is 5 V, the UART M660 interface is 2.8 V (the voltage should not exceed 3.1 V). For the coordination of levels we use the scheme from this article.
Pin 13 (lucky number!) Of the module - output 2.8 V (maximum current 5 mA), specifically designed to power level coordinators. Simply solder to pin 13 of the module, the other end to the level converter circuit.

Sending SMS


To send SMS in text mode, we need:
  1. AT + CMGS = \ "80123456789 \" \ r - enter the command with the phone number (80123456789 in this example).
  2. After this, the module should display the invitation “>” to enter the text of the SMS, which we should do.
  3. Text entry must end with byte 0x1A.
  4. Neoway M660 replies OK - the message has been sent !!!


Receive SMS messages


To receive SMS in text mode, we need:
  1. AT + CMGF = 1 \ r - enable text mode, if there is any doubt that it is enabled.
  2. To decide whether we need to save SMS on the SIM card or in the module’s memory, or simply send them to the UART. For this there is a command AT + CNMI. Since we did not want to keep the SMS in memory, we used this command with the following parameters: AT + CNMI = 3,2,2,0,1 \ r

When a received SMS is sent to the UART in text mode, it consists of two lines:

  1. + CMT: "70123456789" \ r \ n - the first line contains the number of the sender
  2. Text of the message \ r \ n - in the second - the text of the message.

At first we look, from what number the message has come, then - what exactly has come. Conveniently.

Temperature measurement


An LM35 sensor was used to measure the temperature. The sensor produces a voltage proportional to degrees Celsius, 10mV / ºC. Simple and convenient. Sensor supply voltage - from 4 to 30 V.
If the Arduino include an internal source of the reference voltage of 1.1 V (for this, you need to register an analogReference (INTERNAL) in setup ()), then Celsius degrees can be calculated using a simple formula:

DEGREES CELSIUM = READ VALUE x 0.107.

The read value is the one obtained from the analogRead () function:
val = analogRead (analogPin);

English discussions on the LM35 and Arduino: http://playground.arduino.cc/Main/LM35HigherResolution

At the beginning of the test, the temperature sensor was placed on long legs above the Arduino board and showed 28 - 29 ° C at an ambient temperature of 25 ° C. I already started to panic that I had done something wrong, but as soon as the sensor was moved away from the board, the readings became true.
By the way, as it turned out, near the floor the air temperature is 1.5 - 2 degrees lower than on the table.

What it looks like


In the unfolded form, it all looks like this:

In a simple version, you can send SMS commands to turn the heating on / off, receive reports on the state of the heater (on / off) and the measured temperature.



By the way, although it is written to the relay that it starts to operate at a voltage at the input of 3V, it did not work reliably from five volts (it could not immediately work, turn off and turn on again). Therefore, the relay power supply was redone from a 12V input source - in this case, no problems were noticed.

What else can you do?


Source: https://habr.com/ru/post/364459/


All Articles