Scrolling Text - LED GlassesIS31FL3741 I2C Driver

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
Powderjockey
 
Posts: 189
Joined: Fri Mar 31, 2017 10:14 pm

Scrolling Text - LED GlassesIS31FL3741 I2C Driver

Post by Powderjockey »

Can one of the good people in these forums point me to a tutorial for getting the these glasses to show scrolling text?

Thanks

Scott

User avatar
dastels
 
Posts: 15655
Joined: Tue Oct 20, 2015 3:22 pm

Re: Scrolling Text - LED GlassesIS31FL3741 I2C Driver

Post by dastels »

In the tutorial, https://learn.adafruit.com/adafruit-eye ... e-scroller does scrolling in C++.

Dave

User avatar
Powderjockey
 
Posts: 189
Joined: Fri Mar 31, 2017 10:14 pm

Re: Scrolling Text - LED GlassesIS31FL3741 I2C Driver

Post by Powderjockey »

Thanks Dave. I had looked at that, but didn't any further than having the App look for the device. My phone sees a million bluetooth devices, but not the IS31FL3741 board.

I have a green light and have loaded the "blink" demo and the red light is slowly blinking away.

My laptop does not see it either.

Is there a way to turn on the BT or check?

User avatar
dastels
 
Posts: 15655
Joined: Tue Oct 20, 2015 3:22 pm

Re: Scrolling Text - LED GlassesIS31FL3741 I2C Driver

Post by dastels »

You might find something useful in these projects: https://learn.adafruit.com/adafruit-cir ... cuitpython.

Dave

User avatar
osbor
 
Posts: 10
Joined: Wed Mar 20, 2013 3:40 am

Re: Scrolling Text - LED GlassesIS31FL3741 I2C Driver

Post by osbor »

Chiming in to say I'm having the same issue. The 020 glasses are not showing up in the blue fruit ble app for me either. Do they not have the code on board by default to be configurable through the app?

User avatar
dastels
 
Posts: 15655
Joined: Tue Oct 20, 2015 3:22 pm

Re: Scrolling Text - LED GlassesIS31FL3741 I2C Driver

Post by dastels »

The code running on the driver board has to use bluetooth for it to show up and be connectable. I don't know what's on there by default, but I did just manage to order the driver and display boards. I'll be able to dig into it after they arrive next week.

Dave

User avatar
jerryn
 
Posts: 1868
Joined: Sat Sep 14, 2013 9:05 am

Re: Scrolling Text - LED GlassesIS31FL3741 I2C Driver

Post by jerryn »

The default code does not have any BLE functionality. You have to load this demo https://learn.adafruit.com/adafruit-eye ... e-scroller -- There is a .uf2 file provided so just drag/drop it to the board after putting it into bootloader mode (double tap reset).

User avatar
Powderjockey
 
Posts: 189
Joined: Fri Mar 31, 2017 10:14 pm

Re: Scrolling Text - LED GlassesIS31FL3741 I2C Driver

Post by Powderjockey »

I was able to get the BT functionality to work by loading the scripting at https://learn.adafruit.com/adafruit-cir ... cuitpython

Then, in Arduino, if you load the example Glassesdemo3-smooth, the glasses will show the scrolling "Adafruit" as at the top of the learn page for the glasses. I don't see a CircuitPython equivalent on the page. You have to load the boards and the libraries in order to get the examples.

I'm struggling to change colours on the glasses in the script

Code: Select all

// Animate the LED rings with a color wheel.
  for (int i=0; i < glasses.left_ring.numPixels(); i++) {
    glasses.left_ring.setPixelColor(i, glasses.ColorHSV(
      ring_hue + i * 65536 / glasses.left_ring.numPixels()));
  }
  for (int i=0; i < glasses.right_ring.numPixels(); i++) {
    glasses.right_ring.setPixelColor(i, glasses.ColorHSV(
      ring_hue - i * 65536 / glasses.right_ring.numPixels()));
  }
  ring_hue += 1000; // Shift color a bit on next frame - makes it spin

User avatar
dpn982
 
Posts: 10
Joined: Mon Feb 10, 2014 2:29 pm

Re: Scrolling Text - LED GlassesIS31FL3741 I2C Driver

Post by dpn982 »

Is this what you are looking for:

Code: Select all

import time
import board
from busio import I2C
import adafruit_is31fl3741
from adafruit_is31fl3741.adafruit_ledglasses import LED_Glasses
from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService
from adafruit_bluefruit_connect.packet import Packet
from adafruit_bluefruit_connect.color_packet import ColorPacket


i2c = I2C(board.SCL, board.SDA, frequency=1000000)

# Initialize the IS31 LED driver, buffered for smoother animation
glasses = LED_Glasses(i2c, allocate=adafruit_is31fl3741.MUST_BUFFER)
glasses.show()  # Clear any residue on startup
glasses.global_current = 20  # Just middlin' bright, please

ble = BLERadio()
uart = UARTService()
advertisement = ProvideServicesAdvertisement(uart)

while True:
        ble.start_advertising(advertisement)
        while not ble.connected:
            pass
        ble.stop_advertising()

        while ble.connected:
            if uart.in_waiting:
                packet = Packet.from_stream(uart)
                if isinstance(packet, ColorPacket):
                    rgb_int = packet.color[0] << 16 | packet.color[1] << 8 | packet.color[2]
                    glasses.right_ring.fill(rgb_int)
                    glasses.left_ring.fill(rgb_int)
                glasses.show()
            pass
        
	pass
That should change the color rings to the value sent from the bluefruit app. I can not figure out how to get the text from the app though.

User avatar
Powderjockey
 
Posts: 189
Joined: Fri Mar 31, 2017 10:14 pm

Re: Scrolling Text - LED GlassesIS31FL3741 I2C Driver

Post by Powderjockey »

Wow! Thanks @dpn982!

I uploaded your script and now the rings are orange, but I can't see the device on the Bluefruit Connect app.

My next question in all of this and it goes to all of the programming and not in particular these devices, but where can I find what all goes with the commands? Such as:

Code: Select all

glasses.[b]show([/b])  # Clear any residue on startup
glasses.[b]global_current [/b]= 20  # Just middlin' bright, please
I've asked on different forums and for different types of programming languages and never get a proper answer.

Thanks again and I will play with this script.
Scott

User avatar
Powderjockey
 
Posts: 189
Joined: Fri Mar 31, 2017 10:14 pm

Re: Scrolling Text - LED GlassesIS31FL3741 I2C Driver

Post by Powderjockey »

OK, little bit of fun. In ,y previous post I said there were orange rings and not BT. So, no libraries from the code on the board means no BT. So I added the missing libraries, but the library 'adafruit_bluefruit_connect' seems to do something that causes the device to need a soft reboot. Upon the soft reboot it says the same thing. So I remove the library and it tells me the library is missing.

Using the Bluefruit Connect app, there is a cirpy that shows up with out the 'adafruit_bluefruit_connect' library, but when it says it is connected, it does nothing.

the Serial output for the 2 are below:

Code: Select all

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:

Code stopped by auto-reload.
soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
  File "code.py", line 9, in <module>
ImportError: no module named 'adafruit_bluefruit_connect'

Code done running.

User avatar
dpn982
 
Posts: 10
Joined: Mon Feb 10, 2014 2:29 pm

Re: Scrolling Text - LED GlassesIS31FL3741 I2C Driver

Post by dpn982 »

Here is what I have in the lib folder:
Screenshot 2021-11-14 224723.png
Screenshot 2021-11-14 224723.png (20.77 KiB) Viewed 1552 times
There doesn't seem to be much in the way of documentation on this box posted yet. I have been piecing together stuff from examples that I found in the circuitpython libs zip. Not sure if all the things that I put in the libs folder are needed or not, but it works with them all in there.

User avatar
Powderjockey
 
Posts: 189
Joined: Fri Mar 31, 2017 10:14 pm

Re: Scrolling Text - LED GlassesIS31FL3741 I2C Driver

Post by Powderjockey »

Have the lib folder the same as your image. I have nothing showing on the glasses now. No orange circles, no nothing. There is a small red LED on the is31fl3741 board that blinks once in a while.

User avatar
dastels
 
Posts: 15655
Joined: Tue Oct 20, 2015 3:22 pm

Re: Scrolling Text - LED GlassesIS31FL3741 I2C Driver

Post by dastels »

With the libs dpn982 listed, and a slight change to their code, it works to connect to the bluefruit app and let me change colors with the colorpicker.

Code: Select all

import time
import board
from busio import I2C
import adafruit_is31fl3741
from adafruit_is31fl3741.adafruit_ledglasses import LED_Glasses
from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService
from adafruit_bluefruit_connect.packet import Packet
from adafruit_bluefruit_connect.color_packet import ColorPacket


i2c = I2C(board.SCL, board.SDA, frequency=1000000)

# Initialize the IS31 LED driver, buffered for smoother animation
glasses = LED_Glasses(i2c, allocate=adafruit_is31fl3741.MUST_BUFFER)
glasses.show()  # Clear any residue on startup
glasses.global_current = 20  # Just middlin' bright, please

glasses.left_ring.fill(0x880000)
glasses.right_ring.fill(0x008800)
glasses.show()

print("Setting up BLE")

ble = BLERadio()
uart = UARTService()
advertisement = ProvideServicesAdvertisement(uart)

print("BLE set up")

while True:
    print("Advertising")
    ble.start_advertising(advertisement)
    while not ble.connected:
        pass
    print("Connected")
    ble.stop_advertising()

    while ble.connected:
        if uart.in_waiting:
            packet = Packet.from_stream(uart)
            if isinstance(packet, ColorPacket):
                rgb_int = packet.color[0] << 16 | packet.color[1] << 8 | packet.color[2]
                glasses.right_ring.fill(rgb_int)
                glasses.left_ring.fill(rgb_int)
                glasses.show()
Dave

User avatar
Powderjockey
 
Posts: 189
Joined: Fri Mar 31, 2017 10:14 pm

Re: Scrolling Text - LED GlassesIS31FL3741 I2C Driver

Post by Powderjockey »

Thanks a ton Dave. Great starting point.

Do you know if the Ble app allows of the input of text?

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

Return to “AdaBox! Show us what you made!”