1. intro
2. i2c
yum -y install i2c-tools
vi /boot/config.txt
///
dtparam=i2c_arm=on
vi /etc/modules-load.d/i2c.conf
#
i2c-dev
reboot
3. ADS1x15
3.1. address
i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
3.2. python libraries
yum -y install gcc python3-devel python3-pip
pip3 install --upgrade pip
python3 -m pip install adafruit-circuitpython-ads1x15
python3 -m pip install RPi.GPIO
3.3. rmeter-ads1115
wget -N -nv http://d01cid.ddns.net/sharel/bin/rmeter-ads1115 -P /bin/
wget -N -nv http://d01cid.ddns.net/sharel/etc/rmeter-ads1115.conf -P /etc/
wget -N -nv http://d01cid.ddns.net/sharel/usr/lib/systemd/system/ss-rmeter-ads1115.service -P /usr/lib/systemd/system/
systemctl enable ss-rmeter-ads1115
systemctl start ss-rmeter-ads1115
4. ADC Pi Plus ---DRAFT---
4.1. address
i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 69 -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
4.2. python libraries
yum -y install gcc git python-devel i2c-tools-python
git clone https://github.com/abelectronicsuk/ABElectronics_Python_Libraries.git
cd ABElectronics_Python_Libraries/
python setup.py install
4.3. my collector
#!/usr/bin/python
# 06oct2017: initial version (ary)
# 25oct2017: simple version
from ADCPi import ADCPi
from time import sleep
adc = ADCPi(0x68, 0x69, 12)
a = 0
b = 0
c = 0
e = 0
f = 0
g = 0
for m in range(6):
a = adc.read_voltage(1) + a
b = adc.read_voltage(2) + b
c = adc.read_voltage(3) + c
e = adc.read_voltage(5) + e
f = adc.read_voltage(6) + f
g = adc.read_voltage(7) + g
sleep(0.05)
p1 = a * 550
p2 = b * 550
p3 = c * 550
p5 = e * 550
p6 = f * 550
p7 = g * 550
print "%.0f %.0f %.0f %.0f %.0f %.0f" % (p1, p2, p3, p5, p6, p7)
5. cases
6. connectors
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
---|---|---|---|---|---|---|---|
orange |
red |
purple |
yellow |
green |
blue |
||
white |
gray |
brown |
white |
gray |
brown |