[SOLVED] Gigglebot Microbit Micropython I2C error message

I’m using a MacOSx laptop and the Gigglebot + micro:bit, using micropython with the mu-editor v1.0.1, using the dexter hex file micropython override build.v0.3.2-dexterindustries-gb-firmware.hex.

I noted that if I add any method involving the eyes (init(), set_smile, etc.) that after flashing I’ll receive an “OSerror I2C” referencing a line number that is outside (beyond) the scope of the my code (e.g. my code has 10 lines and the error is line number 66).

I have tried the more recent (I believe 4.0) hex file from the github repository; actually I was working with that version prior and switched to the 0.3.2 version to see if it addressed the problem, which it did not.

Other gigglebot methods e.g. drive(), turn(), etc., seem to work fine, I just can’t use the eyes and smile methods without receipt of an I2C error.

Interestingly, I can control the eyes via Microsoft Makecode platform, but this platform is too limited to code, for example, a line follower.

Any help you can offer would be greatly appreciated!

Hello @brad.hontz

I tested it locally. I am running Mu 1.0.2, so slightly different than yours. I’m using firmware 0.4.0, and this is my code:

from microbit import *
from gigglebot import *

init()
while True:
    set_smile(R=100,G=0,B=0)
    sleep(100)
    set_smile(R=0,G=100,B=0)
    sleep(100)
    set_smile(R=0,G=0,B=100)
    sleep(100)

I am not getting any error.

What code are you running?

Thanks so kindly for your reply!

I am heading out now and won’t be back until tomorrow afternoon – I think it would be easier to share a little video so you can see the micro:bit screen concurrent with the code. For example, the first 3 lines of your coding example will generate the error on my end. If I edit out the 3rd line (i.e. init()) all is well.

This would also work just fine:

from microbit import *
from gigglebot import *

while True:

  drive(FORWARD, 100)

  sleep(500)

  drive(BACKWARD, 100)

… it’s really just the methods involving the eyes or smile that invoke an error.

@brad.hontz

And you say it works fine with Makecode, so we’re not looking at a hardware problem. (as an aside, you can totally code a line follower in the makecode environment - you do have access to each sensor value, and you can switch to Javascript if the blocks become painful)

Would you mind trying two other approaches?

  1. https://beta.microbit.edublocks.org/ will also let you code with Python. If you click on the “Blocks” button top right, you will be switched to a Python editor.

  2. There are other instructions here that do not require a change in firmware: https://www.gigglebot.io/pages/program-the-gigglebot-robot-micropython
    Make sure to put the default firmware back onto the microbit first.

I’d be curious to see how these two methods work out for you.

Cleo

Thanks Cleo, just got back to my desk and realized I don’t have the gigglebot / microbit here, they were used at an event over the weekend and someone else carted them home.

I’ll pick them up tomorrow afternoon and look to try your two suggestions prior to making the video I’d offered.

Thanks again!

Brad Hontz

Volunteer

Girl Scouts of Orange County, CA

STEM progam development

Hi Cleo,

I have tried the edublocks that you’d suggested, and I was able to replicate the problem I’d reported earlier. Here’s a video overview: https://youtu.be/lcJgcoTdsek

BTW - the error that is being flashed is “Line 53 OSError I2C write error - 1010” This is consistent with what I was receiving before, although the line number is different depending up the number of lines in the code I’m trying to flash.

Here’s the code causing the fail (copied from edublocks after clicking BLOCKS):

from microbit import *

from gigglebot import *

display.show(Image.YES)

init()

I should note that I have 3 micro:bits and they all act the same way (i.e. all produce this identical error flashing the hex from the code above).

I have attached some python code of a modified linefollower program in which I had removed all references to the eyes and smile, and the attached flashes and works fine with the gigglebot.

Hope this helps you!

Brad Hontz

linefollower2.py (1.11 KB)

Cleo,

Just a quick follow up to my email from yesterday (Thur April 18th). I have some Neopixel strips on hand that I’ve used for a separate (non-Gigglebot) micro:bit project, and I thought I’d try those as they might also invoke the I2C channel; I thought the Neopixel strips were pretty much the same as the Gigglebot’s “smile”.

The code below, which I entered as blocks with the EduBlock editor (just saved it here using the editors “Python” button) works fine on my micro:bit:

np = None

from microbit import *

import neopixel

np = neopixel.NeoPixel(pin1, 30)

for i in range(5):

  for i in range(30):

    np[i] = (255, 0, 0)

  np.show()

  sleep(1000)

  np.clear()

  for i in range(30):

    np[i] = (0, 255,0)

  np.show()

  sleep(1000)

  np.clear()

  for i in range(30):

    np[i] = (0,0,255)

  np.show()

  sleep(1000)

  np.clear()

Not sure were to go from here, so hoping you can help a bit!

Brad Hontz

Volunteer

Girl Scouts of Orange County

STEM program development

@brad.hontz,
my apologies for dropping out. I was out for a while.

When you connect the microbit to a computer, and open up the “drive” that is the microbit (in a file explorer, as if it was a usb drive), you will find a file called “details.txt”.
Could you share the content of this file?

thank you!
Cleo

Hi Cleo,

Thanks for reconnecting! I’m still scratching my head over this issue – was looking at “I2C locking issues” but haven’t really made any headway into determining how to “unlock”. I have reset the micro:bit, both by flashing with the factory flash, and as well using “maintenance mode” following these instructions: https://microbit.org/guide/firmware/

Nothing has worked so far, unfortunately.

I have attached the DETAILS.TXT from the MICROBIT root folder that you’ve requested.

Thanks for continuing to offer your help and suggestions,

Brad Hontz

Volunteer

Girl Scouts of Orange County

STEM program development

DETAILS.TXT (441 Bytes)

Ok, I am totally kicking myself now…
I was re-reading the thread to see if there was something I had missed. Sure enough, I had glossed over the link to your video. I watched it just now.
And I have been enlightened!

The microbit has to be inserted into the gigglebot for the init() method, or any other led-oriented method, to work.
Right now, the microbit is sending a message to the neopixels, and simply reporting back that the neopixels are not answering.

I tried it on my own microbit and have replicated your error message. As soon as I insert the microbit in the gigglebot, the message went away.

Could you please confirm that this is indeed your situation?

Cleo

OMG!!!, thank you so much Cleo, that was absolutely just driving me crazy. I just hope I can remember in a month to ignore the error on sync! Yes, the simple 3 line code as well as the more complicated line follower (where I initially noted the issue, I’ve attached the micro python script) both work when attached to the gigglebot.

Thanks again for your patience!

Brad Hontz

Volunteer,

GSOC STEM program development

linefollower.py (1.91 KB)

1 Like

Thank you for sticking through this hurdle and not giving up!!!

Btw, thank you for volunteering your time with the Girl Scouts. My kids loved their time in the organisation. Volunteers are never thanked enough.

Greatly appreciate the kudos and thank you, glad your kids enjoyed the Girl Scout program.

I’m not sure how long ago your girls were involved (my daughter is now 30) but Girl Scouts are now on a mission to rectify the gender imbalance within STEM fields and I’m doing what I can to support their mission.

In terms of the Gigglebot, I’m working on creating content (basically “how to do” pictorial guides) that troop leaders can run at troop meetings in the interest of having their girls earn robotics badges. There are now badges at nearly every level of Girl Scouting; daisies, brownies, juniors and cadettes.

If you have access to any curriculum that you feel would be of help, if convenient, please pass it along! I’ll be happy to share my Gigglebot-based guides with any other Girl Scout organization, if you are currently connected to more than just our Orange County council through my exchanges.

Thanks again for your assistance,

Brad Hontz

This topic was automatically closed after 4 days. New replies are no longer allowed.