IoT-Vertebrae

De binefa.com
Salta a la navegació Salta a la cerca

Introducció

IoT-Vertebrae - Bridging OT & IT. Snap!Con 2023 and video (July / 17 / 2023)

IoT-Vertebrae Bridging OT & IT. DLM 2023 (29 / abril / 2023) - Diada de la Llibertat del Maquinari 2023

Material

Recull d'informació sobre l'IoT-Vertebrae (usuari: EdT, contrasenya: EdT2324)

Snap! amb websockets no segurs

Detecció d'adreces I2C a la Raspberry Pi

pi@raspberrypi:~ $ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- -- 
10: 10 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 

Python

pi@raspberrypi:~/iot-vertebrae $ python
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import iotv
>>> iotv.aversion("0000")
Analog rib version: 1.0
'0000000100000000'
>>> iotv.dversion("0000")
Digital rib version: 1.2
'0000000100000010'
>>> iotv.getdsetup("0000")
A digital output, B digital input
'00010010'
>>> iotv.getasetup("0000")
respA: 0x1, respB: 0x2
A rib is ADC, B rib is DAC.
'00010010'
>>> iotv.dsetup("0000","ain","aout")
ain, aout
Setup has not been changed
False
>>> iotv.getdsetup("0000")
A digital output, B digital input
'00010010'
>>> iotv.dsetup("0000","ain","bout")
ain, bout
True
>>> iotv.getdsetup("0000")
A digital input, B digital output
'00100001'
>>> iotv.dsetup("0000","aout","bin")
aout, bin
True
>>> iotv.getdsetup("0000")
A digital output, B digital input
'00010010'
>>> iotv.ain("0000",'a',1)
19881
>>> iotv.ainv("0000",'a',1)
i2cAddr: 0x10, addrChannel: 0x1
res: 0x4DAA: 19882
0x4DAA --> 19882 --> 4.94V
19882
>>> iotv.ainv("0000",'a',2)
i2cAddr: 0x10, addrChannel: 0x21
res: 0x4DBE: 19902
0x4DBE --> 19902 --> 4.95V
19902
>>> iotv.aout("0000",'b',2,4095)
dacCommand: 0x32
It has been sent 0xFFF (10.00 volts) to DAC 2
>>> iotv.ainv("0000",'a',2)
i2cAddr: 0x10, addrChannel: 0x21
res: 0x6781: 26497
0x6781 --> 26497 --> 9.90V
26497
>>> iotv.aout("0000",'b',2,2047)
dacCommand: 0x32
It has been sent 0x7FF (5.00 volts) to DAC 2
>>> iotv.ainv("0000",'a',2)
i2cAddr: 0x10, addrChannel: 0x21
res: 0x4DBB: 19899
0x4DBB --> 19899 --> 4.95V
19899
>>> iotv.din("0000",'b')
'00000000'
>>> iotv.din("0000",'b')
'00100100'
>>> iotv.din("0000",'b')
'00000000'
>>> iotv.dout("0000",'a',0x5A)
>>> iotv.dsetup("0000","aoutpwm","bin")
aoutpwm, bin
True
>>> iotv.getdsetup("0000")
A PWM output, B digital input
'00010100'
>>> iotv.doutpwm('0000','a',255)
>>> iotv.doutpwm('0000','a',55)
>>> iotv.doutpwm('0000','a',0)
>>> iotv.dsetup("0000","aout","bin")
aout, bin
True
>>> iotv.getdsetup("0000")
A digital output, B digital input
'00010010'
>>> iotv.doutbit('0000','a',0,1)
>>> iotv.doutbit('0000','a',0,0)
>>> iotv.dsetup("0000","aoutpwm","bin")
aoutpwm, bin
True
>>> iotv.getdsetup("0000")
A PWM output, B digital input
'00010100'
>>> iotv.doutbitpwm('0000','a',0,55)
>>> iotv.doutbitpwm('0000','a',0,255)
>>> iotv.doutbitpwm('0000','a',0,0)
>>> iotv.dsetup("0000","aout","bin")
aout, bin
True
>>> iotv.getdsetup("0000")
A digital output, B digital input
'00010010'
>>> 
pi@raspberrypi:~/iot-vertebrae $

Exemple d'ús

Control via Snap! (MQTT al cap + CanBus)

Smart Toys (MQTT a la Raspberry Pi + I2C)

CanBus a l'IoT-Vertebrae