Well, it took 2 days almost to figure out for myself how to get temperature from i2c controller (named B38 Temperature I2C Sensor). It was just enough simple for me to feel ashamed for not understanding this before. So now, I will try to get thought all 40 sensors (or at least some of them), so other ppl will be able to just copy-paste and make it working without extra googling. It’s python unless stated otherwise. Remember to install libmraa first
For now there is only i2c Temperature sensor
Done
B03 Microphone Sensor Module
Python code
#!/usr/bin/env python import mraa import time gpio_1 = mraa.Gpio(16) gpio_1.dir(mraa.DIR_IN) while True: if gpio_1.read()==1: print("Contact") time.sleep(0.05)
B08 Touch Sensor
Anomaly
Anomaly 1 out pin is always have voltage from power pin. That’s may end not well if you connect it to 5V input, use 3.3v input.
Anomaly 2 conclusion from Anomaly 1, because of this it’s always status “1” without touch and it will status “0” if touchPython code
#!/usr/bin/env python import mraa import time gpio_1 = mraa.Gpio(16) gpio_1.dir(mraa.DIR_IN) while True: print(gpio_1.read()) time.sleep(1)
B14 Button
Anomaly
Anomaly 1 out pin is always have voltage from power pin. That’s may end not well if you connect it to 5V input, use 3.3v input.
Anomaly 2 conclusion from Anomaly 1, because of this it’s always status “1” without button pressed and it will status “0” if button pressedPython code
#!/usr/bin/env python import mraa import time gpio_1 = mraa.Gpio(16) gpio_1.dir(mraa.DIR_IN) while True: print(gpio_1.read()) time.sleep(1)
B37 8 LED PCB
Notice
Remember to first activate “i2c7”
To get LED number in bit form you need to 2^LED number, so as example to turn on\off only 7 and 6 you need to 2^7+2^6=192, so you need x.writeByte(192) to work with only 7 and 6. To work with 7, 6 and 5 you need 2^7+2^6+2^5=224 - x.writeByte(224), etc, etcPython code
#!/usr/bin/env python import mraa as m import time x = m.I2c(0) x.address(0x20) x.writeByte(128) time.sleep(1) x.writeByte(64) time.sleep(1) x.writeByte(32) time.sleep(1) x.writeByte(16) time.sleep(1) x.writeByte(8) time.sleep(1) x.writeByte(4) time.sleep(1) x.writeByte(2) time.sleep(1) x.writeByte(1) time.sleep(1)
B38 Temperature I2C Sensor
Notice
Remember to first activate “i2c7”
Python code
#!/usr/bin/env python import mraa as m # initialise I2C x = m.I2c(0) # to initialize exactly our i2c device we need to bind it's address which is 4F x.address(0x4F) # Now we say "Update temperature value in memory" x.writeByte(0x00) # Now we extract this value d = x.read(2) # the sensor can be from 8 bit to 13 bit correct (actually from 7 to 12, but later on that), # i just choose to use 13 bit because there is no drawbacks # by doing this I'm able to get 13 bit value which is our temperature in bit form temp_c = (d[0] << 5) | (d[1] >> 3) # here is detection of +\-, basically out of 13 bit the very first bit is always used to say is temp # positive or negative. If it's 1 it's negative, if it's 0 it's positive if (temp_c>>11) == 1: temp_c = temp_c - (1 << 13) temp_c = temp_c * 0.03125 print(temp_c)
Not done
B01 Joystick Module (XY Axes)
In Progress
B04 IR Optical Detection
In Progress
B06 Hall TTL Sensor
In Progress
B07/B31 NTC Threshold TTL/ NTC 10k
In Progress
B09 RGB LED
In Progress
B10/B11 Bicolor LED 5/3mm
In Progress
B12/B13 Reed Sensor
In Progress
B15 Tilt Sensor
In Progress
B16 Rotary Encoder
In Progress
B18 Light Barrier
In Progress
B19 Potentiometer / Analog Hall
In Progress
B20 1-wire Temperature module
See jolla post
May be helpful there and there
B21 IR LED
In Progress
B23 Shock Sensor
In Progress
B24 Temperature & Humidity
Require driver to be made
Additional information (and example for Raspberry Pi) there
https://github.com/adafruit/Adafruit_Python_DHT/blob/master/source/Raspberry_Pi_2/pi_2_dht_read.c
B25 1 Watt LED Module
In Progress
B26 Piezo Speaker
In Progress
B27 Buzzer
In Progress
B28 Flash LED
In Progress
B29 Heartbeat
In Progress
B30 Photoresistor
In Progress
B32 5V Step-engine with driver PCB
In Progress
Was not able to get it on
B36 Motion Detection / Bewegungsmelder
No matter what it’s always 0.6 on out pin, so i have no idea, what i do wrong, since i only not jumped in front of it…
B22 IR Receiver 38kHz
There is just no library for IR, at least ATM
Can’t test or don’t have any use for it
- B02 5V Relay Module
- B05 Flame Sensor
- B34 Voltage Regulator linear
- B35 Voltage Regulator