This is the first post of a 3-part series about reading out an SMA solar inverter over Bluetooth and displaying some readings every few seconds. Long-time readers may remember theΒ Solar at lastΒ weblog post from several years ago and theΒ SMA Relay, based on a JeeNode v6. The Bluetooth readout code was derived from Stuart PittawayβsΒ Nanode SMA PV MonitorΒ code.
This project is for a friend whoβs birthday is coming up shortly, and who has the same SMA 5000TL inverter as I do β although it can probably be used with other models.
Here is the gadget, powered off 5V USB:
Thereβs no RF relay in this unit, although I may build a second one for use at JeeLabs, with an RFM69 instead of the LCD.
There are many sides to this project, i.e.
- Β΅C choice: Iβll be using a low-cost STM32F103 board from AliExpress
- 2Γ16 character LCD, which is a bit old-school, but hey,Β it worksβ¦
- Bluetooth: Iβve selected a simple βHC05β unit, from eBay
- actual hardware connections
- talking to BT via the 2nd UART
- packet protocol encoding/decoding
- setting up permanent BT pairing
- formatted number display
- enabling the hardware watchdog
- automatic start on power-up
- a 3D-printed enclosure
The STM32F103C8 board in this unit is this one, but aΒ Blue PillΒ would work just as well:
Thereβs a micro-USB socket on the bottom, but it can only be used for power (doh!) β the USB pins do not seem to be connected. So a USB-to-serial adapter will have to be used during development β no big deal.
The communication over Bluetooth uses the Serial Port Profile (SPP), but thereβs a fairly obnoxious packet format on top, which needs to be generated before sending and decoded upon reception.
Hereβs the basic packet structure:
The trick is to send out just the packets needed to obtain the desired readings, without getting intoΒ whatΒ those packet details mean. Luckily, all the hard work has been done years ago, for theΒ SMA Relay.
Since Iβll be using an STM32 with Mecrisp, the main task on the software side will be to port the code over to Forth and to add some basic stuff, e.g. output to the LCD display.
Source:Β SMA Solar readout β part 1