LoRa RFM9X OLED & DC Stepper MotorBonnet Confliction

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ahbdigitalstudio
 
Posts: 7
Joined: Mon Nov 29, 2021 6:00 pm

LoRa RFM9X OLED & DC Stepper MotorBonnet Confliction

Post by ahbdigitalstudio »

Project Build

Controller Set Up
Raspberry Pi Zero W; Product ID: 3400
Adafruit LoRa Radio Bonnet with OLED - RFM95W @ 915MHz - RadioFruit; Product ID: 4074

https://drive.google.com/file/d/1ygqSMf ... sp=sharing

The Controller set up works by following the tuttorials.
No Conflicts.
The LoRa Module Powers up, and displays to the screen.

&

Reciever Set Up
Raspberry Pi Zero W; Product ID: 3400
Adafruit DC & Stepper Motor Bonnet for Raspberry Pi; Product ID: 4280
Adafruit LoRa Radio Bonnet with OLED - RFM95W @ 915MHz - RadioFruit; Product ID: 4074

https://drive.google.com/file/d/1Nh_OIH ... sp=sharing

The Reciever set up is having problems.
The Motor Bonnet works fine with the pi and nothing else installed.
The Motor Bonnet works fine with the LoRa module Installed.
When installing the LoRa Moduel, the Lora Moduel has problems.
When running the python3 rfm9x_check.py test script, the raspberry pi fails to find the rfm9x module.
It appears that the display is still working in the background Proccess.
It is to be noted that the display came non-operational, and I have tested to see if the module was still operational.

pi@raspberrypi:~ $ python3 rfm9x_check.py
RFM9x Error: Failed to find rfm9x with expected version -- check wiring
RFM9x Error: Failed to find rfm9x with expected version -- check wiring
RFM9x Error: Failed to find rfm9x with expected version -- check wiring
RFM9x Error: Failed to find rfm9x with expected version -- check wiring
RFM9x Error: Failed to find rfm9x with expected version -- check wiring
RFM9x Error: Failed to find rfm9x with expected version -- check wiring
RFM9x Error: Failed to find rfm9x with expected version -- check wiring
^C
Traceback (most recent call last):
File "/home/pi/rfm9x_check.py", line 82, in <module>
display.show()
File "/usr/local/lib/python3.9/dist-packages/adafruit_ssd1306.py", line 209, in show
self.write_cmd(xpos1)
File "/usr/local/lib/python3.9/dist-packages/adafruit_ssd1306.py", line 264, in write_cmd
self.i2c_device.write(self.temp)
File "/usr/local/lib/python3.9/dist-packages/adafruit_bus_device/i2c_device.py", line 84, in write
self.i2c.writeto(self.device_address, buf, start=start, end=end)
File "/usr/local/lib/python3.9/dist-packages/busio.py", line 165, in writeto
return self._i2c.writeto(address, memoryview(buffer)[start:end], stop=stop)
File "/usr/local/lib/python3.9/dist-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 49, in writeto
self._i2c_bus.write_bytes(address, buffer[start:end])
File "/usr/local/lib/python3.9/dist-packages/Adafruit_PureIO/smbus.py", line 314, in write_bytes
self._device.write(buf)
KeyboardInterrupt

I have disconnected the LoRa Module, and ran it with the same sim card on another Raspberry Pi Zero W without the stepper motor bonnet installed, and the unit works.
I have disconnected the Stepper Motor Bonnet, with the same Raspberry Pi Zero W and LoRa Module, and the LoRa Module works. "The display is still not working, but the unit is responsive."

This leads me to believe that there is a confliction with the I2C & or SPI addressing.

The tuttorial states that the Stepper Motor Bonnet has a default I2C Address of 0x60.

The tuttorial states that the LoRa Module uses SPI for interfacing.
CS - Radio SPI Chip Select pin, connected to SPI CE1 on the Pi

The tuttorial states that the LoRa Modules 128x32 OLED display uses I2C with;
SCL is connected to SCL on the Pi.
SDA is connected to SDA on the Pi.

I have enabled Enabling Second SPI
If you are using the main SPI port for a display or something and need another hardware SPI port, you can enable it by adding the line
dtoverlay=spi1-3cs
to the bottom of /boot/config.txt and rebooting.

Both the extra SPI and the Stepper Bonnet I2C are displaying when querying the system.
- --
pi@raspberrypi:~ $ sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

I am not sure if it is a CS line issue, with a CE0 or CE1 wiring conflict.
https://learn.adafruit.com/circuitpytho ... rs-devices
https://learn.adafruit.com/circuitpytho ... -device-id

Does anyone see the conflict here?

User avatar
ahbdigitalstudio
 
Posts: 7
Joined: Mon Nov 29, 2021 6:00 pm

Re: LoRa RFM9X OLED & DC Stepper MotorBonnet Confliction

Post by ahbdigitalstudio »

Both use I2C

Motor Bonnet uses I2C for Motor Control

LoRa uses I2C for OLED

Every HAT must have a unique I2C address.

Motor Bonnet
The default address is 0x60.
Can adjust range from 0x60 to 0x80 for a total of 32 unique addresses.

Note 0x70 is the "all call" address and all boards will respond.

LoRa
OLED
SSD1306 chipset
sudo i2cdetect -y 1
You should see the following, indicating that address 0x3c (the OLED display) was found.
https://learn.adafruit.com/adafruit-pio ... y-pi/usage

No Conflict on I2C Address.

Check GPIOs used on LoRa;
SDA = GPIO 2
SCL = GPIO 3
Btn 1 = GPIO 5
Btn 2 = GPIO 6
Btn 3 = GPIO 7
DO = GPIO 9 SPI Data Out --} SPI MISO
DI = GPIO 10 SPI Data In --} SPI MOSI
CLK = GPIO 11 SPI Clock --} SCLK
DIO0 = GPIO 22 Digital IO#0 Status IRQ
DIO1 = GPIO 23 Digital IO#1 Status Cut?
DIO2 = GPIO 24 Digital IO#2 Status Cut?
RST = GPIO 25 Radio Reset
CS = GPIO 26 SPI Chip Select --} CE1
DIO3 = Digital IO#3 Not Connected
DIO4 = Digital IO#4Not Connected

chip select pins can be used to access multiple SPI slaves, with shared clock and data lines for all slaves.

The chip select signal from the master is used to select the slave. This is normally an active low signal and is pulled high to disconnect the slave from the SPI bus. When multiple slaves are used, an individual chip select signal for each slave is required from the master.

https://learn.adafruit.com/circuitpytho ... igital-i-o

https://learn.adafruit.com/circuitpytho ... rs-devices

SPI used
Check Coding Conflict

Motor Bonnet
Check GPIOs used on Bonnet;
SDA = GPIO 2
SCL = GPIO 3

User avatar
ahbdigitalstudio
 
Posts: 7
Joined: Mon Nov 29, 2021 6:00 pm

Re: LoRa RFM9X OLED & DC Stepper MotorBonnet Confliction

Post by ahbdigitalstudio »

Checking PiOLED - 128x32 Mini OLED on LoRa Moduel
Using Adafruit Tutorial for the SSD1306 chipset with the CurcuitPython Library
https://learn.adafruit.com/adafruit-pio ... y-pi/usage

Checking I2C
sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: 70 -- -- -- -- -- -- --

OLED I2C 3C Detected

Verifying if the 12C Device is Functional with the stats.py test script.


python3 stats.py

Display Verified Not Operational
https://drive.google.com/file/d/1JipQkU ... sp=sharing
https://drive.google.com/file/d/1bix1Ue ... sp=sharing

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: LoRa RFM9X OLED & DC Stepper MotorBonnet Confliction

Post by Franklin97355 »

Do you have any questions about this? Do you see the i2c if you mount each bonnet separately?

User avatar
ahbdigitalstudio
 
Posts: 7
Joined: Mon Nov 29, 2021 6:00 pm

Re: LoRa RFM9X OLED & DC Stepper MotorBonnet Confliction

Post by ahbdigitalstudio »

Yes, lots of questions thank you.
I have tested a known working LoRa Moduel without the the motor bonnet, and it works fine. I hook up the pi, Motor Bonnet, and LoRa Module, and the LoRa fails to detect. I am not sure if there is a programming issue in Circuit Python that conflicts. Right now I am trying to diagnose why the OLED is not working on one of the LoRa Moduels, but I do not care if the OLED is working becuase it will be tucked away in a Remote Controlled Project were I cant see it, but it helps for troubleshooting so I am trying anyways.

Primary issue is getting the LoRa moduel to work with the Motor Bonnet. The Motor Bonnet works with, and without the LoRA Moduel attached.

And yes, the I2C detects with everything mounted sep,

I am thinking to just hook each bonnet to its own Pi Zero W, and just communicate through bluetooth, or Wifi, but that increases the complexity and reliability of the build.

User avatar
ahbdigitalstudio
 
Posts: 7
Joined: Mon Nov 29, 2021 6:00 pm

Re: LoRa RFM9X OLED & DC Stepper MotorBonnet Confliction

Post by ahbdigitalstudio »

Alterd the Display Code * tested OLED on Known Working LoRa Moduel without Motor Bonnet, and defective Module with Motor Bonnet.

Code: Select all

# Modifying Python Code to test OLED Display Again

import time
import busio
import board

# Import the SSD1306 module.
import adafruit_ssd1306

# Create the I2C interface.
i2c = busio.I2C(board.SCL, board.SDA)

# Create the SSD1306 OLED class for the 128x32 OLED Display.
# The first two parameters are the pixel width and pixel height.
display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c)

# Clear display.
display.fill(0)
display.show()

# Create blank image for drawing.
width = display.width
height = display.height

# Display Some Text
display.text('Is', width-85, height-7, 1)
display.show()
time.sleep(1.0)
display.fill(0)
    
# Display Some Text
display.text('This', width-85, height-7, 1)
display.show()
time.sleep(1.0)
display.fill(0)

# Display Some Text
display.text('Working?', width-85, height-7, 1)
display.show()
time.sleep(1.0)
display.fill(0)

# Clear display.
display.fill(0)
display.show()
Video of code and LoRa OLED Working
https://youtu.be/60v0nhfaa-w

Will next try to install Motor Bonnet on Working Moduel to see if any problems are resolved with the two interfacing.

User avatar
ahbdigitalstudio
 
Posts: 7
Joined: Mon Nov 29, 2021 6:00 pm

Re: LoRa RFM9X OLED & DC Stepper MotorBonnet Confliction

Post by ahbdigitalstudio »

PROBLEM SOLVED
The MotorBonnet & LoRa Moduel Do Work Together With No Problems.
Adafruit shipped a defective unit, after hours of diagnosing.
https://drive.google.com/file/d/1yARvOI ... sp=sharing
https://drive.google.com/file/d/1yLCa2p ... sp=sharing
https://drive.google.com/file/d/1yFlo6b ... sp=sharing
Working Image
Working Image
3.jpg (337.38 KiB) Viewed 285 times

User avatar
ahbdigitalstudio
 
Posts: 7
Joined: Mon Nov 29, 2021 6:00 pm

Re: LoRa RFM9X OLED & DC Stepper MotorBonnet Confliction

Post by ahbdigitalstudio »

If anyone needs help with there set up, please let me know.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”