Raspberry has 17 GPIO pins able to be programmed as input or output so these can be used as digital I/Os. They manage segnals with few Volts with the same electric potential of Raspberry, it is not a good idea have a long wiring with these signals, the risk is for the incoming noise and electric spike, they could hung up the Raspberry CPU.
For this purpose an expansion board need to be developed where 8 digital signal 24Vcc are optoisolated and adapted to the Raspberry GPIOs voltage and 8 Raspberry digital outputs drives relès. Relés make outputs optoisolated so driven signals can go far way from Raspberry.
For each digital input a this circuit is implemented
For digital output we bought a board from the market suitable for interfacing with Raspberry. Unfortunately this board reveses the commands from Raspberry, this not acceptable because during the Raspberry boot up for a litte time all reles are on. For this reason on the board an 8 inverter ports (74LS240) is applied in order to have the correct driving condition.
An analog input is needed in order to get the current observatory temperature. We bought an I2C analog to digital converter ADS1015. This is able to get 4 single ended signal or 2 differential signal. We select the second option in order to connect one PT100 termoresistor, this assure e low noise signal. This is the only not optioisalted signal so ti can’t go much far away from controller. A trimmable resistance che adjust the current flowing in the PT100 so to have precise measure.
An I2C FRam memory is mounted allowing the controller to save information need to be retained when power down. It has 32Kbyte more than enough.
In the resource the full board schematic is available