<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:x-small"><br></div></div><div><div style="font-size:x-small" class="gmail_default"><font size="2">In a nutshell:</font></div><div class="gmail_default"><font size="2"></font></div><div class="gmail_default"><b><font size="2">On the QtPy :</font></b></div><div class="gmail_default"><div class="gmail_default"><font size="2">* program the qtpy using VSCode + PlatformIO + Arduino framework <br></font></div><div class="gmail_default"><font size="2">* I usually run VSCode on my Windows/Linux laptop and use the VSCode "remote" feature, but that was not working reliably for this case, so for this I simply run VSCode on the Pi directly and use VNC<br></font></div><font size="2">* use the "</font><font size="2">Adafruit_BNO08x" Arduino library</font></div><div class="gmail_default"><font size="2">* add a 1sec delay at power-up / reset, to allow the virtual serial port to get properly initialized and to give the Pi and QtPy some time to do their virtual serial port handshaking<br></font></div><div class="gmail_default"><font size="2">* be sure to explicitly reset the bno - i have found that otherwise it sometimes does not work properly on power-up<br></font></div><div class="gmail_default"><font size="2">* configure the bno085 to report "game rotation vectors" @ 100Hz</font></div><div class="gmail_default"><font size="2">* use polling to get the values from the bno085 (no I/O pin left on the QtPy to use the interrupt signal from the bno085)<br></font></div><div class="gmail_default"><font size="2">* @ 100Hz, print current time, yaw and the 8 analog readings from the QtPy's analog inputs using Serial.printf() like so: </font><font size="2"><br></font></div><div class="gmail_default"><font size="2">* Serial.printf("%09lu,%+07.3f,%03d,%03d,%03d,%03d,%03d,%03d,%03d,%03d\r\n",
t_now,
imu_yaw,
a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7])
</font></div><font size="2"><span class="gmail_default" style="font-size:x-small"></span><br></font></div><b><font size="2">O<span class="gmail_default">n the Pi:</span></font></b></div><div><font size="2"><span class="gmail_default">* using python</span></font></div><div><font size="2"><span class="gmail_default">* use serial.read() from the python serial library - with timeout ( not serial.readline() - that one does not perform well)<br></span></font></div><div><font size="2"><span class="gmail_default">* parse the comma-separated values (see printf() statement above) via the scanf function from the scanf python library</span></font></div><div><font size="2"><span class="gmail_default">* do some math to compensate for the ~1.5 ... 2.0 degrees worth of offset/error that accumulates for every 360 degrees of rotation.<br></span></font></div><div><font size="2"><span class="gmail_default"><br></span></font></div><div><font size="2"><span class="gmail_default">I invited you to 2 of my github repos. romi/qtpy.py is the code for the Pi, io_slave_2 is the code for the QtPy itself.<br></span></font></div><div dir="ltr"><div><br></div><div><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 28, 2021 at 11:01 PM Thalanayar <span class="gmail_default" style="font-size:x-small"></span>Muthukumar <<a href="mailto:tnkumar@gmail.com">tnkumar@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Chris,</div><div><br></div><div>I also have a QTPy connected to a BNO055 and would like to have the information accessible to the RPi.</div><div><br></div><div>It was interesting to hear of the communication you have built between the RPi4 and QTPy.</div><div><br></div><div>If you have any pointers on how to accomplish this, will appreciate it. Thanks.</div><div><br></div><div>Regards.</div><div>- Kumar</div><br></div>
</blockquote></div></div></div></div>