In this post, I will briefly describe the hardware component of the project I introduced in this Part I.
First of all, I have chosen to use Arduino Mega  because it provides four hardware UART interfaces. I have allocated them as follows:
- UART0 (Serial): used for informative and debug messages that can be visualized in the Serial Monitor box of Arduino IDE
- UART1 (Serial1): used to communicate with the photovoltaic inverter
- UART2 (Serial2): used for the communication with the WiFi module
- UART3 (Serial3): spared for possible future use
To make the cabling a little bit easier, I have also bought a Proto Shield V3:
RS485 interface and connection
To implement the RS485 interface, I have used a board like this one:
This board is powered by 5V rail provided by Arduino, thus it can interface 5V signals directly. I have used the digital pin #25 to control the direction of the RS485 transceiver.This signal is connected to both DE and RE pins of the transceiver. RO is connected to RX1 (digital pin #19), and DI is connected to TX1 (digital pin #18).
To connect the inverter, I have used a 4-wire shielded cable, about 50 cm long (Tasker C4015). I don’t think its impedence is 120 Ohm, however this should be negligible for the relatively slow baud rate used for the communication (19200 Bps). The following image shows the RS485 interface connector on the inverter side.
I have connected the cable as follows:
- conductor #1
- “A” signal on Arduino’s RS485 connector
- “+T/R” on inverter side
- conductor #2
- “B” signal on Arduino’s RS485 connector
- “-T/R” on inverter side
- conductors #3 + #4 (used as voltage reference)
- “GND” on Arduino’s RS485 side
- “RTN” on inverter side
- left floating on Arduino’s RS485 side
- “LNK” on inverter side.
Please note that, as shown in the previous image, I needed to disconnect the 120 Ohm termination on the inverter side, otherwise the communication would not work. 
IMPORTANT UPDATE (2017-01-28)
When I put into service the data logger, it stopped working at all (!), so I had to analyse in detail the problem. With the help of the debugging options, I found out that most of the times, the data frames received from the inverted were corrupted (in other words, CRC did not match). I had then a look at the reading operation used to retrieve the p/n. It should read this string:
Expressed as hexadecimal values, it is:
0x2D 0x33 0x4D 0x30 0x38 0x45
Instead, the string that was read was:
0x2D 0x33 0x4E 0x30 0x38 0x45
Bolded value is the wrong one.
I used an oscilloscope to verify if the RS485 link was affected by severe signal integrity problems. I did not find any, even if tried all the possible combinations of terminating the ends of the connection (both terminated, Arduino-side terminated only, inverter-side terminated only). It seems the problem was related to bias network of the RS485 interface of Arduino. When I removed its termination, the link started to work. I honestly don’t have the time to further investigate this. Since I don’t have the schematics of this part, I firstly should reverse-engineer it. This is not the primary goal of this project …
Humidity and temperature sensor
I have chosen the well-known DHT11 module as humidity/temperature sensor. 
It has been connected directly to the pins of the Proto Shield. For data line, I have used the digital pin #12.
ESP8266 WiFi module interfacing
Interfacing the WiFi module has not been that easy.
I have had to make a simple handmade board hosting:
- The ESP8266 module itself.
- A bidirectional level shifter to convert Arduino’s 5V RX/TX signals to 3.3V.
- A linear regulator to generate 3.3V starting from Arduino’s 5V. 3.3V power rail is used to supply the ESP8266 module and the low-voltage side of the shifter circuitry.
This is the level shifter that I have used.
The following image shows the linear regulator board instead.
On ESP8266 side, I have connected the signals as follows:
- GND to ground
- VCC to 3.3V
- CH_PD to 3.3V
- RST left floating
- GPIO0 left floating
- GPIO2 left floating
- UTXD <-> level shifter <-> RX2 (digital pin #17)
- URXD <-> level shifter <-> TX2 (digital pin #16)
On the handmade board, I also have put here and there some bypass capacitors (10 uF, 1 uF and 100 nF) to clean the supply voltages, because this board is connected to the Proto Shield with relatively long cables.
In the next post of this series, I’ll describe the software running on the Arduino board.
 For the sake of completeness, I have used an Arduino Mega 2560 R3.
 I honestly don’t have the time to investigate this issue, which seems to be a typical signal-integrity-related problem …
 I’m considering the possibility of replacing it with DHT22, which offers better resolution and accuracy.
One thought on “Photovoltaic data logger – Part II”
Comments are closed.