PI-SPI-DIN-4AO Address Programming
The PI-SPI-DIN-4AO 4 channel 4-20 mA analog output module has 8 possible addresses. The default address is 0x60, or "0" as defined in the libwidgetlords libraries.
When more than one analog output module is used, the address of the additional modules have to be re-programmed as follows:
Make sure libwidgetlords library version 2.0.0 (or higher) is installed.
Copy the program pi_sp_din_4ao_prog.py into your working directory. This program can be found on our Github repository located here:
https://github.com/widgetlords/libwidgetlords/blob/master/python/pi_spi_din_4ao_prog.py
Please note: When programming, only ONE PI-SPI-DIN-4AO module can be connected at one time.
To check for the current address, run:
i2cdetect -y 1
This will return a value of all the I2C address - there should be connected an address of 0x60 thru 0x67
When programming and asked for an address, enter only digits 0, 1, 2, 3, 4, 5, 6 or 7. This corresponds to:
0x60 = 0
0x61 = 1
0x62 = 2
0x63 = 3
0x64 = 4
0x65 = 5
0x66 = 6
0x67 = 7
Also, run the program in a terminal in the working directory as sudo as follows:
sudo python3 pi_spi_din_4ao_prog.py
and follow the instructions as they appear on the screen.
Here is a sample program for 3 modules connected together:
from time import sleep
from widgetlords.pi_spi_din import *
init()
outputs_0 = Mod4AO(0)
outputs_1 = Mod4AO(1)
outputs_2 = Mod4AO(2)
while True:
outputs_0.write_single(0, 800)
outputs_0.write_single(1, 4000)
outputs_0.write_single(2, 800)
outputs_0.write_single(3, 4000)
sleep(2)
outputs_0.write_single(0, 4000)
outputs_0.write_single(1, 800)
outputs_0.write_single(2, 4000)
outputs_0.write_single(3, 800)
sleep(2)
outputs_1.write_single(0, 800)
outputs_1.write_single(1, 4000)
outputs_1.write_single(2, 800)
outputs_1.write_single(3, 4000)
sleep(2)
outputs_1.write_single(0, 4000)
outputs_1.write_single(1, 800)
outputs_1.write_single(2, 4000)
outputs_1.write_single(3, 800)
sleep(2)
outputs_2.write_single(0, 800)
outputs_2.write_single(1, 4000)
outputs_2.write_single(2, 800)
outputs_2.write_single(3, 4000)
sleep(2)
outputs_2.write_single(0, 4000)
outputs_2.write_single(1, 800)
outputs_2.write_single(2, 4000)
outputs_2.write_single(3, 800)
sleep(2)
Block Diagram
Connection Methods
The PI-SPI-DIN-4AO module can be used with the PI-SPI-DIN-RTC-RS485 Module
Or the Pi to PI-SPI-DIN Series Adapter Module