The Neo Pixel are chainable, addressable leds hardware that can be controlled using only one signal wire.

The NeoPixel service allow you to connect and control an Neo Pixel hardware connected to an Arduino with MRL



The NeoPixel hardware can connect to any pins on the arduino board, including analog pins

Note: Neopicel hardware can draw a lot of power (60mA for each pixels at full brightness). If you are running big NeoPixel hardware, you should power it with external power source instead of the Arduino.



#file : service/ edit raw
#working on version 1.0.1566 and over

from time import sleep

#Starting Arduino Service
arduino = Runtime.createAndStart("arduino","Arduino")
arduino.setBoardMega() #or arduino.setBoardUno()

#Starting NeoPixel Service
neopixel = Runtime.createAndStart("neopixel","NeoPixel")

#neopixel.attach(arduino, pin, number of pixel)
neopixel.attach(arduino, 29, 16)

#"Color Wipe"
#"Larson Scanner"
#"Theater Chase"
#"Theater Chase Rainbow"
#"Rainbow Cycle"
#"Flash Random"

#speed: 1-65535   1=full speed, 2=2x slower than 1, 10=10x slower than 1
#starting a animation
#neopixel.setAnimation("Animation Name", red, green, blue, speed)
neopixel.setAnimation("Theater Chase", 255, 0, 0, 1) #running Theater Chase with color red at full speed


#run an animation with python script
#turn off all the pixels
for pixel in range (1,neopixel.numPixel + 1):
  neopixel.setPixel(pixel, 0, 0, 0)  #setPixel(pixel, red, green, blue)
neopixel.writeMatrix() #send the pixel data to the Neopixel hardware 
for loop in range(0,10): #do 10 loop
  for pixel in range(1, neopixel.numPixel +1):
    neopixel.setPixel(pixel, 255, 0, 0) #set the pixel to red
    sleep(0.03) #give a bit of delay before next step
    neopixel.setPixel(pixel, 0, 0, 0) #turn off the pixel

hairygael's picture

Great input Calamity !! I'm

Great input Calamity !!

I'm going to set that in my next script !

moz4r's picture

Tested with a deported nano

Tested with a deported nano and 90% worky :) Great work

( I use a nano and the script launch fine but only once. It stuck the deported arduino and need to be hand reset )

There no errors in the log after the last line : NEO_PIXEL_SET_ANIMATION

Setup :

I solder wires on RX/TX 3 onto the nervoboard ( don't use RX/TX0 !! it is usb ) to connect nano RX/TX

This is the script I use from your work :

[MRL 1803]

from time import sleep
arduino = Runtime.createAndStart("arduino","Arduino")

arduino1 = Runtime.createAndStart("arduino1","Arduino")

neopixel = Runtime.createAndStart("neopixel","NeoPixel")
neopixel.attach(arduino1, 3, 16)
neopixel.setAnimation("Theater Chase", 255, 0, 0, 1) #running Theater Chase with color red at full speed

MdG_NL's picture

Thanks Anthony for sharing

Thanks Anthony for sharing your test script.

I think the bug with the Nano has to do with the RX/TX at the Nano side...

These are still connected to the FTDI chip onboard !

I will use a Arduino Pro Mini board, this one is without a onboard FTDI chip.


Here a view to the updated NervoBoard:



mayaway's picture


So the script above gets loaded onto the Nano?

which gets plugged into the USB Hub?



MdG_NL's picture

Hi Stephen, The srcipt is

Hi Stephen,

The srcipt is Phyton based, which can run via MRL !
The Nano just need the MRLComm.ino sketch to communicate with MRL.

The script from Calamity needs a USB connection to the Nano...
And the script from Moz4r is connected via "RX / TX 3" from the Arduino Mega !
So the Mega and the Nano are connected with the same USB.
USB -> Arduino_Mega -> RX / TX 3 -> Nano



mayaway's picture

Nano hookup

Hi Martin,

It makes sense that the Nano would hold the *.ino script so it would become another device that MRL could manage. I am unsure about the USB -> Arduino_Mega -> RX / TX 3 -> Nano

My plan was to use Calamity's script (I didn't know there were two, and don't know which one I have...)

I think I would load *.ino onto the Nano, then plug it in via usb to the InMoov's USB Hub -- I have the tablet, the Mega's, the Camera's, and (for now) a mouse on the hub. MRL should see the Nano (probably) on COM5 since the Mega's are showing up on 3 and 4

Does this sound right?



MdG_NL's picture

Hi Stephen, Yes all sounds

Hi Stephen,

Yes all sounds right if you like to use the Calamity *.py :)
Double check your com port number during the *.ino upload.
(You will need to select the correct com port anyway before you can upload.)



mayaway's picture

NeoPixel Service

I have v1723 with these lines

neopixel = Runtime.createAndStart("neopixel","Serial")
neopixel.connect("COM5", 57600, 6, 1, 0)
I have uploaded MRLComm.ino to the Arduino Nano which is powerd externally and PIN 6 feeds data to the Neo-Pixel Ring
The nano is plugged into the USB Hub
Gael's gestures make a call like neopixel.write(3)
This all sounds right?
moz4r's picture

documentation check

@hairygael @MdG_NL @Calamity

Hi Guys I don't have last nervoboard so I can't validate rx/tx pins place, can you check if I don't make mistakes please ?



MdG_NL's picture

Looks very good and cool


Looks very good and cool Anthony, great work !

And the RX / TX pins are correct named in your HowTo.




moz4r's picture

thank you Marten !

thank you Marten !