0

starting with the dotstar off?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

starting with the dotstar off?

by sketchy on Wed Jul 11, 2018 8:52 am

i am not clear on what is probably an obvious thing.

i'm using arduino ide on itsy bitsy m0 express. i want to turn off as many peripherals / external components as possible. the dotstar is on when booting. other than importing the dotstar library, is there a "faster" "more efficient" way to turn off components like the dotstar?

also, if you have a reference for all the components/peripherals i should consider turning off (in m0 standby mode) for lowest power, i'd appreciate the link. i'm new to low power "isms" and "gotchas".

Thank you - as always - VERY MUCH.

sketchy
 
Posts: 202
Joined: Thu Jun 28, 2012 11:37 pm

Re: starting with the dotstar off?

by aaronaverill on Wed Jul 11, 2018 9:08 am

You can talk to dotstars with SPI.

Here's my Circuit Python code for the Trinket M0 to turn off the dotstar which I imagine is very similar. Hopefully you can translate it to C.

Code: Select all | TOGGLE FULL SIZE
# Turn off the internal dotstar
spi = SPI(board.APA102_SCK, board.APA102_MOSI)
while not spi.try_lock():
    pass
spi.configure(baudrate=4000000)
spi.write(bytearray([0,0,0,0,0xE0,0,0,0,0xFF]))
spi.deinit()


The important bytes are the array you send.
bytes 0-3 = four 0x00
byte 4 = three high bits set to 1 followed by five bits set to the brightness = 1110000 = 0xE0
byte 5-7 = BGR data (all 0x0)
byte 8 = terminating 0xFF

Hopefully this helps.

aaronaverill
 
Posts: 79
Joined: Sun Jun 03, 2018 10:45 am

Re: starting with the dotstar off?

by sketchy on Wed Jul 11, 2018 11:48 am

Thank you Aaron. I will give your code a twirl. Very much appreciate it.

I would prefer Circuit Python, but sadly Circuit Python currently does not support goodies like m0's standby mode. Have you done any work/play on other areas of low power w/ Circuit Python?

sketchy
 
Posts: 202
Joined: Thu Jun 28, 2012 11:37 pm

Re: starting with the dotstar off?

by aaronaverill on Wed Jul 11, 2018 12:06 pm

sketchy wrote:Thank you Aaron. I will give your code a twirl. Very much appreciate it.


Please share the Arduino code if you have a chance and get it working.

sketchy wrote:I would prefer Circuit Python, but sadly Circuit Python currently does not support goodies like m0's standby mode. Have you done any work/play on other areas of low power w/ Circuit Python?


Yeah, the python is ridiculously fun + easy to work with. I came into the python first, and feel like I need to try Arduino just for a complete "experience" in microcontrollers, but... man... I told myself 20 years ago I would never write C++ code again... and I haven't yet found a need. :)

I haven't done anything with sleep modes in python but that team is very responsive to requests and I imagine contributed code would be appreciated.

aaronaverill
 
Posts: 79
Joined: Sun Jun 03, 2018 10:45 am

Re: starting with the dotstar off?

by languer on Sat Jul 14, 2018 12:47 am

This post gives you some ideas on low power operation on the trinket.

viewtopic.php?f=52&t=135218&p=677387#p677387

languer
 
Posts: 31
Joined: Fri May 17, 2013 2:02 pm

Re: starting with the dotstar off?

by sketchy on Sat Jul 14, 2018 7:10 am

That is very helpful. Thank you for your kind post.

sketchy
 
Posts: 202
Joined: Thu Jun 28, 2012 11:37 pm

Please be positive and constructive with your questions and comments.