AUTOMATION WITH ARDUINO, ETHERNET, RTC, LCD AND DHT11

automation projects with AutomationShield 2.0 project with Ethernet W5100, RTC DS130, LCD I2C, DHT11, Android application and an HTML page for configuring, scheduling and activating the card
components
Hardware Components
Automation Shield 2.0 board
X 1
Arduino NANO V3.0
X 1
w5100 Ethernet shield
X 1
Ethernet shield based on the W5100 chip.
details

ucc_auto.png

The image below shows how the ICSP connection between Shield and Arduino Nano should be. The connection must be made in such a way that the shields are connected as shown in the image below. In addition to the ICSP connection, it is necessary to jump pins D13, D12, D11 and D10.

Output Connections

Source Code
The source code of the project is 100% compatible with the two Ethernet Shields based on the w5100 chip (Mini Shield and Arduino Uno).

Html
page The HTML page must be opened in the browser and can be executed from computers or Android devices.
The header shows the time, temperature, humidity and Mode. Only in Automatic (Scheduled) mode, direct activation of the outputs is allowed. The page updates the time and status of the card outputs every 5 seconds.

The page has a functionality to change the time recorded in the DS1307

Allows you to change the scheduling times of the relay outputs

And in manual mode, the buttons are enabled to trigger the outputs directly

On the page the board access IP is configured, if the board’s IP is changed, it is necessary to change the ipArduino variable with the new access IP.

Arduino source code.
The source code of the Arduino uses the same basis as the Aquadroid project. Below I highlight three important items, the first is the configuration of the I2C address of the LCD, the source code is configured with the address “0x3F”, it is the default address of the LCDs 1602, some LCDs 4004 use the address 0x27, it is necessary to identify the correct address for LCD operation, in case of problems, use the I2cScanner. The second item is the IP, if it is necessary to change, change the content of the variable byte ip [] with the new IP.

The program has the variable EEPROMCommands   that is assigned the value false . Changing to true it will record the last commands received in the EEPROM, thus, if a power failure occurs and the card restarts, it will be reestablished with the last commands sent by the user. The Arduino EEPROM has a useful life of 100,000 recordings, keeping all the commands received in the EEPROM will make it useless, so check the number of commands sent daily to determine the useful life. The scheduling time and mode variables are recorded directly in the EEPROM and must not be removed.

Let’s see a video of the project.

Configuring external access (Over the Internet).

The first step is to retest the connection before starting the settings, if a problem occurs it will be more difficult to identify the cause.

Test the card’s return directly, type in the browser the ip http://192.168.0.202 of the card. The answer of the plate must be presented as shown in the image below.
If the return is presented successfully, we can proceed to the next step of configuring the router. Do not attempt to configure external access before successfully connecting to the local network.
Configuring the router
A DPC3925 router will be used, it is one of the models provided in lending over the Net.
Access the router’s configuration interface through the IP http://192.168.0.1 in the browser. The page below should be presented.
The factory settings of this router model do not require UserName and Password, check your router’s manual for IP and authentication access. In the DPC3925 model, we click on LogIn without filling in any fields. After login, click on the Applications & Gaming menu.

And then on the PortRange Forwarding submenu.

We must configure a line in the table with:

External Start Port and EndPort: Fill with the port that will be used for access, we must choose a port other than 80, which is usually blocked by the operators, as a suggestion use port 8091.
IP Address: This is the IP of the internal network that will be redirected through port 8091 for external access, enter the IP 192.168.0.202 configured in the Arduino connections.
Start Port and End Port: These are the ports used in the IP that is being configured, in Arduino we use port 80.
Protocol: Select the TCP option.
Enable: Check the option to enable the setting.

Click Save Settings to save the settings.

Testing external access
To test external access we need to find out the external IP of our router, the easiest way is to access the website www.meuip.com.br.

 To confirm that our configuration was successful, we opened our external IP in the browser with the port configured in the previous step. http://189.121.XXX.XXX:8091. For privacy reasons, just in this post I changed my last six IP numbers for XXX, use your IP correctly. The access to the board can be done on the local network through the Arduino IP and through external access with the routed IP and configured port.

The html page can be changed for external access, just change the variable with the IP and Port.

For example, If the router’s IP is 200.201.202.203 the change should be:
var ipArduino = ‘http://200.201.202.203:8091’, do not forget to put: between the IP and Port.

The setup page must open correctly.

Configuring the Android application.
The configuration of the Android application is simple, we should just change the IP of the Arduino for the IP of the Router and configured port, as done in the setup page.

After configuration, access is successful.

The configuration of the external access of the router requires special attention. If someone finds out your IP and the protocol of the card will have full access to your automation card! Is there any way to resolve this? Yes, but with some router models that allow updating to firmware that supports the creation of a VPN, the VPN creates a tunnel between the router and the device it is accessing. But that is a subject for a future post. Never access your open or unsecured network card.

documents
Code
projects with AutomationShield 2.0.

COMMENTS

Please Login to comment
  Subscribe  
Notify of
POSTED BY
TAGS