Using RTC and BNO055 on Particle Photon


We would like to send out Euler and Linear Acceleration data to a Raspberry Pi (which is also an Access Point) from some Particle Photons. The rate of sending data is 0.1 second and would like to use the RTC in order to timestamp the collected data from the BNO in a JSON payload

{   ‘particle-location’:
                       ‘Euler’: {‘h’: xx.xx, ‘p’: xx.xx, ‘r’:xx.xx},
                       ‘LinAcc’: {‘x’:22.22, ‘y’: 33.33, ‘z’: 44.44}
       ‘timestamp’: value_from RTC
<br><br>we found that both <b>BNO055 </b>and <b>DS1307 </b>require the <b>I2C interface. </b>Is there any way to use both of them on the same Particle Photon? Is there any possibility to use the <b>Serial (TX, RX) </b>for acquiring the RTC data if the BNO is connected to I2C0?<br><br>having RTC Timestamps are crucial and would be great if both of them could be interfaced on the photon. What other boards provide 2 I2C interfaces if the photon is not up for the job.<br><br><br>Thanks<br>



I2C is a multi-master and multi-slave protocol, so you can attach multiple I2C devices to the same bus.
The only important thing is that every device must have different addresses.

Here below a sample code for Particle Photon connected to DS1307 and BNO055:

from maxim.ds1307 import ds1307
from bosch.bno055 import bno055
import streams


bno = bno055.BNO055(I2C0)
ds = ds1307.DS1307(I2C0)

Enabled Accelerometer

bno.init(“acc”) # Operating Mode ACCONLY (only raw accelerometer data)

while True:
data = bno.get_acc(“x”) # Read Data on x axis
print(“Acceleration on X axis”, data)
data = bno.get_acc(“y”) # Read Data on y axis
print(“Acceleration on Y axis”, data)
data = bno.get_acc(“Z”) # Read Data on z axis
print(“Acceleration on Z axis”, data)
data = bno.get_acc() # Read Data on 3 axis
print(“Acceleration on XYZ”, data)
print("%02d:%02d:%02d - %02d/%02d/%d - %d"%ds.get_time())

Let me know if this can help you :)

Acceleration on X axis -0.11
Acceleration on Y axis -0.81
Acceleration on Z axis 9.7700004
Acceleration on XYZ [-0.09, -0.8, 9.7700004]
00:00:00 - 00/00/2000 - 0
-------------------------------------------------------- ```

Yes, it works. Thank you. however, the

ds.set_time(17,30,0,8,9,2017,5) # 8.9.2017 17:30:00 Friday

does not set the time. I tried it by adding the above line before the


but the time still remains the same at as above (00:00:00 - 00/00/2000 - 0)

I have the SparkFun break out board and according to the guide SQW pin is optional to connect. Does it have to do with this problem? Or should I make the MCU idle before for a few seconds before the db.start()?



You have to call the set_time() method after the ds.start() instruction; the start() method, indeed, initializes the I2C peripheral and the set_time() method sends through I2C message the time to be set.

You can find here more info about I2C Zerynth driver.


Thank you for the support. Just found out I had the wiring wrong for the SDA, SCL.
It works.