Hi Franco,
> On 15.06.2016, at 10:02, Franco Guida <
franco...@invisia.ch> wrote:
>
> [...]
> What do you mean with “but I've been using RS485 on the RPi“? Are there Pins on the board that can been used for RS485?
In my project I used a USB to RS485 adapter (because that's what I had already lying around), which then appears as /dev/ttyUSBx in Linux.
But yes, there are two serial interface (UART) pins on the Rpi connector (RXD pin 10, TXD pin 8), which are connected to the /dev/ttyAMA0 linux device. These pins have the correct serial signal, but with logic voltage levels (0..3.3V), not real RS422 or RS485 levels.
The shield you mentioned just adds the needed RS485 level shifter to these pins, so you can use /dev/ttyAMA0 as a real RS485 device on the DB9 connector.
> The weather station that I use is an Elsener PS8. Are there also example for a PS8? or can I use the example from the P03?
I had a look at the data sheet of the PS8, the protocol is very similar, but not 100% the same.
So the example code provides a nearly complete solution, except for the actual decoding of the PS8 message, which is a bit different.
Have a look at:
- main.cpp line 48: numTelegramBytes - for the PS8 this must be 57, not 40 (PS8 has longer message)
- main.cpp line 162ff: this is where the sensors are set-up. The PS8 does have a similar, but not exactly the same set of sensors. You might need to adapt these definitions (but you can probably leave it as-is for the first tests).
- main.cpp line 336ff: this is where the telegram bytes are decoded and reported into the dS system. These lines need to be adapted for the PS8 telegram format (as documented in the datasheet of the PS8)
hope this helps!
Best Regards,
Lukas