# Makerverse 2ch Motor driver with Piicodev BME280

**URL:** <https://forum.core-electronics.com.au/t/makerverse-2ch-motor-driver-with-piicodev-bme280/15200>\
**Category:** Core Electronics\
**Created:** [26 September 2022 01:35 UTC](https://forum.core-electronics.com.au/t/makerverse-2ch-motor-driver-with-piicodev-bme280/15200 "2022-09-26T01:35:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![John122579](https://avatars.discourse-cdn.com/v4/letter/j/b5e925/32.png) [@John122579](https://forum.core-electronics.com.au/u/John122579)\
**Post date:** [26 September 2022 01:35 UTC](https://forum.core-electronics.com.au/t/makerverse-2ch-motor-driver-with-piicodev-bme280/15200/1 "2022-09-26T01:35:07Z")

</div>

Have used Piicodev BME280 library and Makerverse motor library successfully separately, but if I initialise an instance of BME280 sensor I have problems. Sometimes a reboot “hangs” but if it succeeds then one motor channel is on constantly. I assume it has something to do with the GPIO pins I am using (2,3,4,5).  
Is there a way of changing the default I2C pins for Piicodev?

---

<div class="post-metadata">

**Author:** ![Liam](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/liam/32/3562_2.png) [@Liam](https://forum.core-electronics.com.au/u/Liam)\
**Post date:** [26 September 2022 02:54 UTC](https://forum.core-electronics.com.au/t/makerverse-2ch-motor-driver-with-piicodev-bme280/15200/2 "2022-09-26T02:54:38Z")

</div>

Hi John,

Interesting issue, would it be possible to send through a copy of your code and a photo.

You can certainly can change the I2C pins: [GitHub - CoreElectronics/CE-PiicoDev-BME280-MicroPython-Module: This is the firmware repo for the Core Electronics PiicoDev® Atmospheric Sensor BME280](https://github.com/CoreElectronics/CE-PiicoDev-BME280-MicroPython-Module)

For example, if you wanted to use pins 20 and 21 (Uses I2C1, not 0 which is default), and making sure to import Pin!

```auto
from machine import Pin
atmo = PiicoDev_BME280(bus=1, sda=Pin(20),scl=Pin(21))

```

Liam

---

<div class="post-metadata">

**Author:** ![John122579](https://avatars.discourse-cdn.com/v4/letter/j/b5e925/32.png) [@John122579](https://forum.core-electronics.com.au/u/John122579)\
**Post date:** [26 September 2022 06:17 UTC](https://forum.core-electronics.com.au/t/makerverse-2ch-motor-driver-with-piicodev-bme280/15200/3 "2022-09-26T06:17:08Z")

</div>

Hi Liam,

the relevant code is listed below…

import uasyncio  
from microdot\_asyncio import Microdot, Response  
from microdot\_utemplate import render\_template

from Makerverse\_Motor\_2ch import twoMotorRobot

from myhtml import menuhtml  
from machine import Pin  
from time import sleep

import random

from PiicoDev\_BME280 import PiicoDev\_BME280  
from PiicoDev\_Unified import sleep\_ms # cross-platform compatible sleep function

dir\_A = Pin(2, Pin.OUT)  
dir\_A.value(0)  
dir\_B = Pin(4, Pin.OUT)  
dir\_B.value(0)  
pwm\_A = Pin(3, Pin.OUT)  
pwm\_A.value(0)  
pwm\_B = Pin(5, Pin.OUT)  
pwm\_B.value(0)

johnny5 = twoMotorRobot(pwmPinLeft = 3, dirPinLeft = 2,  
pwmPinRight = 5, dirPinRight = 4)

try:  
sensor = PiicoDev\_BME280() # initialise the sensor  
except:  
print('No BME280 detected.’)

If I comment out the code in BLUE it all works fine.

Will try initialising with the code you supplied and get back to you.

Cheers

---

<div class="post-metadata">

**Author:** ![Liam120347](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/liam120347/32/5003_2.png) [@Liam120347](https://forum.core-electronics.com.au/u/Liam120347)\
**Post date:** [26 September 2022 06:29 UTC](https://forum.core-electronics.com.au/t/makerverse-2ch-motor-driver-with-piicodev-bme280/15200/4 "2022-09-26T06:29:05Z")

</div>

Hi John,

Sorry the PiicoDev Expansion board only breaks the I2C pins out via 8/9 so you’d have to wire them out of the respective pins directly.

If you strip back your code to run just the sensor and motor driver does that work? There might be some conflicts with scheduling somewhere

---

<div class="post-metadata">

**Author:** ![John122579](https://avatars.discourse-cdn.com/v4/letter/j/b5e925/32.png) [@John122579](https://forum.core-electronics.com.au/u/John122579)\
**Post date:** [26 September 2022 07:17 UTC](https://forum.core-electronics.com.au/t/makerverse-2ch-motor-driver-with-piicodev-bme280/15200/5 "2022-09-26T07:17:22Z")

</div>

On this particular project, I am not using the Piicodev breakout just the BME280 so it should work with what you gave me. Won’t get to it until tomorrow to test.

---

<div class="post-metadata">

**Author:** ![John122579](https://avatars.discourse-cdn.com/v4/letter/j/b5e925/32.png) [@John122579](https://forum.core-electronics.com.au/u/John122579)\
**Post date:** [26 September 2022 21:59 UTC](https://forum.core-electronics.com.au/t/makerverse-2ch-motor-driver-with-piicodev-bme280/15200/6 "2022-09-26T21:59:47Z")

</div>

I tried instantiating the BME280 sensor with different SCL and SDA pin designations and all works well.  
Thank you for finding a simple solution.

Cheers

---

<div class="post-metadata">

**Author:** ![Liam120347](https://yyz2.discourse-cdn.com/flex028/user_avatar/forum.core-electronics.com.au/liam120347/32/5003_2.png) [@Liam120347](https://forum.core-electronics.com.au/u/Liam120347)\
**Post date:** [26 September 2022 23:50 UTC](https://forum.core-electronics.com.au/t/makerverse-2ch-motor-driver-with-piicodev-bme280/15200/7 "2022-09-26T23:50:05Z")

</div>

Glad to hear John!

Thanks for circling back and posting that it worked!  
We’re keen to see what you make😁
