Conrad 10180 Operation Manual

Before we start
… a few important announcements and notes on successful and stress-free work with the calendar.
Using this manual is only one of two possible approaches to the calendar. The second option is to use the website
www.conrad.de/iot-adventskalender
as a source of information. The two instructions are almost identical in text, but the medium Internet permits an even larger offer of information that may ease the way to success.
One example for the higher information content is the fact that some additional images could be integrated on the website. A website is not bound to limitations such as print costs for page number limits and permits multi-layered and colourful design. Some additional articles may also be helpful for the development and design of own projects.
Another important help is the comment function. Internet of Things is a complex and exciting, as well as multi-dimensional subject. There are many tripwires on the way to a successful project. It can only be helpful when a problem can be presented to a larger community. Therefore, the comment function is activated under each article, in which questions can be asked, improvements suggested or other project participants can be helped with their projects. I hope that this will minimise the irritation of every individual and to keep the fun in the project high even when things get skewed.
A third benefit of the website can be the surprise factor. The Advent calendar's excitement is that you do not know what is behind the next door. In a handbook, you usually already see the experiment on the next page, and are "spoiled". The website only shows the current day's chapter every day. Therefore, here is my advice: Just put this manual away after this chapter and don't get it out again. Instead, go to www.conrad.de/iot-adventskalender and set a bookmark on your PC, Smartphone or tablet. Then you can read the current day's chapter every day, wherever you are, e.g. on the train on the way to work, and experiment with the practical part of the day's project later when you have come home.
All of those who still love a classic manual, will of course stick with this book. It can be quite comfortable not to have to hold a digital device while you are trying to get a first overview of your current experiment. However, visiting the website is still necessary. You need to download the current program, after all. You can find it in the respective article under "The Program".
No matter which way you go when working through the calendar: I hope that you will have fun and wish you a happy and exciting pre­Christmas period.
Yours, Fabian Kainka
Day 1: The first steps
It is the first day of December and thus time to open the first door. Behind the door, you will find the most important part of this calendar: the Arduino™-compatible NanoESP-board with integrated WLAN module that this calendar is about.
As you can see quite well on the PCB, the board is made up of two components. The left half is an Arduino™-compatible micro controller system that can be compared to the Arduino™ Nano. The right part is the WLAN module with the designation ESP8266. These two components communicate via a serial interface generated by software. The Arduino™-side rather acts as the boss, forwarding the commands to the WLAN module. Some of these commands will already be tried out today on the first day.
The programme
The program of the respective day can be downloaded by going to
www.conrad.de/iot-adventskalender
selecting your language and calling the article for the current project. You will find the download under the headline "The Program". The Arduino™-software is used as the developing environment. The current version can be found on the website:
arduino.cc
I have worked with Arduino™-versions 1.6.4 – 1.6.5. Older versions may cause problems. For some Linux versions, there is currently only a very old version. Advice on how to solve this and other problems can be found on the website. In the Arduino™ software, you need to select Arduino™ Nano as a board and the serial port. Then you can upload the program.
Today's download is a very simple program that does nothing but pass on all data received through the serial hardware interface of the
microcontroller to the ESP controller via a self-defined software interface. The entire thing works in the opposite direction as well. As you can see in the source text, the two connections of the software interface are pins 11 and 12. They should not be used as GPIO-pins in your own projects. You also need the SoftwareSerial library. The library is pre-installed in most Arduino™ versions, but if not, you should download it via the Manager.
After the program has been uploaded, you can start the serial monitor of the Arduino™ interface. Before you can start, two important settings must be made to the Serial Monitor, i.e. the baud rate must be set to "19200" in the lower right corner and the setting "CR and NL" must be made in the box to its left.
After setting, you can see a message, i.e. an AT and a few lines, followed by OK. The command AT was sent to the ESP module by the microcontroller and the module answered OK. You can see by this that the module works and is ready for use.
You can test this again by sending the command
AT
by serial monitor. The uploaded program again passes on the command to the ESP module, which in turn answers OK. The next command that you can test is:
AT+GMR
This command outputs the current firmware and version number. The command
AT+RST
resets the module. You will see a few illegible characters on the terminal first, followed by ready, which says that the module is now ready. Use
AT+CWMODE
to specify the WLAN mode. There are three options: Mode 1 is the station mode. This means that you can log into a present WLAN in the module. Mode 2 is the AccessPoint mode. This means that you can log on to a WLAN provided by the module with a WLAN-capable device. Mode 3 is dual mode. You can both log on to a present WLAN with the module and make a direct connection to another device. Test the AccessPoint mode by specifying mode 2 with the command
AT+CWMODE = 2
and then using the command
AT+CWSAP=”MyNanoESP”,”MyPassword”,5,3
to set the parameters for the access point. You can then find the network MyNanoESP e.g. with a WLAN-capable computer, and connect with the password MyPasswort. When the connection has been successfully established, you can use
AT+CWLIF
to display the connected device with IP and MAC address.
The AT commands in the serial monitor
You can now also test station mode by first switching modes with
AT+CWMODE=1
. You can have all available WLAN networks in range with the command
AT+CWLAP
. You can use
AT+CWJAP=“MySSID“,“MyPassword“
to connect to your network, with MySSID and MyPassword being replaced by your network name and your password. It may take quite a while until the connection is established, but the end will be confirmed with OK. The first connection has now been established.
Day 2: Google Ping
With today's project, you test whether you can reach the Google server. This is used as a test of whether there generally is a connection to the Internet or, e.g., a firewall is blocking the NanoESP-board.
You will find a plug board behind today's door. The plug board is used as an experimenting platform later, to connect sensors and other elements. It is best if you plug the controller onto the plug board as shown in the following figure. This leaves you the most space for experiments, while the WLAN module protrudes over the plug board at the rear. The micro USB cable is then suspended between the contact sides and will only interfere minimally.
The NanoESP on the plug board
The programme
The example program from the website has mostly automated the processes that you entered manually in the first example. The controller sends commands to the ESP module in sequence, thus connecting to the WLAN, among others. The differently long time-out times give the module enough time to answer.
Before the programme can work properly, you need to enter your WLAN data behind the two #defines SSID and PASSWORT right at the
beginning of the programme source code. The module needs access to the Internet to execute its last command. The command
AT+PING
pings other devices in the network. Pinging means a request of whether an address can generally be reached. Here, the Google server is pinged with AT+PING=“www.google.de“. When a response returns, a success message appears in the serial monitor and the LED labelled D3 that is connected to Pin D13 at the board is activated. The first communication with the Internet is successful.
Day 3: UDP-Send
In today's project, data are exchanged between the board and the PC through the WLAN for the first time. The prerequisite for this is that your computer has a WLAN adapter. The UDP (User Datagram Protocol) is used. Another program on the PC-side ensures successful receipt of the messages.
Behind the third door of the calendar, you can find an insulated cable that you will need to build circuits. To prepare for later experiments, you can place the supply lines ground and VCC on the outer tracks.
The programme
When you load the program onto the controller, the controller is configured as an access point and you should see an open network called NanoESP. Before connecting to the network, first download another program from the Internet. In my experiments, I used the programme Pack­et Sender by Dan Nagle which you can download from the following link:
https://packetsender.com/
After loading and installing the program, you can connect your PC to the open network of the NanoESP. Ensure that the firewall recognises the network as a home network, to avoid blocking data. Your computer should now have the IP 192.168.4.2. You can check this by sending the command
AT+CWLIF
to the module via the serial monitor. This command shows all computers connected to the access point with IP and MAC addresses.
Start the program Packet Sender; set the UDP server port to 90 in Settings->Network and click the check box "Enable UDP Server". Usually, the lower left should say UDP:90. If it does not, you need to restart the software once.
The program on the computer is now used as UDP server, while the controller is set as UDP client. The differentiation between client and server is not clear in the UDP protocol, but in this case it means that you will send data from your controller to the computer.
To send data, use the command:
AT+CIPSEND=7.
The 7 means the number of characters to be sent. The character > is returned. This means that you can now send your message. Enter Hello and confirm with Enter again. The module returns SEND OK, although you have only entered five characters. This is because after your input Carriage Return and New Line are sent as well, i.e. two characters more that you need to include in your message length calculation.
When you switch back to the Packet Sender and look at Log Traffic there, you can see the receipt of the message. In the ASCII view, you will even see the two enclosed characters, represented by \r and \n. Therefore the first communication between board and PC via the WLAN has been successful.
Day 4: UDP bidirectional
In yesterday's project, the UDP communication was tested in one direction, i.e. from the board to the PC. In this program, the module is set so that communication in the other direction is possible as well, almost like in a chat.
Behind the fourth door of the Advent calendar, there is a resistor with 1 k (brown, black, red). The component is not used in today's test yet, but should be kept for later.
The programme
Today's program generally only contains a very small change that has a great effect on the communication with the UDP protocol. When you upload the program, another access point with which you can connect to a PC is generated. Again, you will need Packet Sender or a comparable program. Start the program and make the same settings as yesterday (File-> Settings->Network: Enable UDP Server, Port 90). Then you need to enter the address of the module (192.168.4.1) in the main window in the IP address field, set the port to 91 and select the item UDP in the dropdown menu farther to the right. When these settings have been made and the serial monitor has been opened, you can send the first message to the module by entering, e.g., Hi in the field labelled with ASCII.
If you click Send now, the Serial Monitor will show +IPD,2:Hi OK
The message has been received. You can now also answer, by using the CIPSEND command again, e.g. AT+CIPSEND=7. >Hello
Chatting with two devices is possible, though very impractical.
Day 5: Switching an LED
Today's programme is finally about controlling hardware via the UDP protocol. In this case, an LED is switched on and off with simple commands.
You will find an LED board behind the fifth door. The right dropping resistor already was in yesterday's door. Build the circuit as the picture shows.
The programme
While the previous example programs needed many user inputs, today's program is to work autonomously. Nevertheless, the serial monitor will continue to output information for debugging purposes.
The controller will now wait for data received from the module that are announced by the +IPD message. Legitimate commands that you can send through the Packet Sender are led1 and led0. The controller interprets them and switches the LED on and off accordingly. Feedback to the transmitter is transmitted as well. If another command is sent, the serial monitor reports "Wrong UDP Command". The same message is also submitted to the transmitter via the network.
Day 6: UDP-Button
In yesterday's program, the first commands were evaluated by the controller. Today's program maintains this function but can also additionally send a command into the network independently.
You will find a button behind today's door. It is used as a simple sensor here. Connect it to the controller as shown in the setup image.
The programme
The program continues to evaluate the incoming signals. Additionally, the button is continually queried. When the user actuates it, the controller sends the text
Button=1
to the network. All devices connected to the module with a UDP server on port 90 can receive the command. For a building automation project, a server would receive the status message, e.g. of a motion sensor, and then reset the command led=1 to activate the light.
Day 7: Analogous sensor
In the last project, a button was used to deal with the simplest form of a sensor. This time, a potentiometer should be used as an analogue sensor to permanently send measured values into the network.
Loading...
+ 10 hidden pages