Just an update on the plantarium workshop.
Thanks to everyone that came. We had a busy day doing both ‘wet lab’ - planting seeds and succulents in glass containers, and ‘dry lab’ - getting to grips with the arduino IDE, and talking about the principles of programming and how programmable LEDs could be adapted for growing plants with electronic lights.
For those that weren’t there, I had some technical issues on the day, which I have now resolved. Here are a couple of things I learned in troubleshooting my Neopixel Jewels:
-
There is a an arduino function library specific for Neopixel products that you need to install before you can run the example scripts given online for these devices. This is found in Sketch>Include Library>Manage Libraries (choose Adafruit Neopixel, and ignore anything not named as such).
-
Check your start up parameters:
Although I thought my Neopixel was misbehaving at the workshop, I realised I had changed a parameter which controls how many of the 7 pixels are illuminated, and altered the brightness when I was testing it before the workshop and had simply forgotten. It was very quick to reset this.
-
There is some example code called ‘strandtest’ available from the manufacturer, which not only tests a range of animations across the pixels but is also a great place to start for copying and pasting some functions into a sequence of your own design. You can look in:
Sketchbook→Libraries→Adafruit_NeoPixel→strandtest
to find this, if you can’t see it, just download a copy of the Adafruit Neopixel library and unzip it to find the examples folder. Its in “strandtest>strandtest.ino”. This is available by clicking the green button in the middle of this page
I’ve modified this code to produce a simple red, green, blue, white start up test, followed by a ‘night’ (all pixels off’, then a ‘day’ - all pixels on, then another 'night.
Currently, what I understand to be the ‘time’ parameter - fourth number after three colour values, is set to 1000, but the intervals are approximately 14 seconds long. I’m not sure why this is, though the jewel has 7 pixels and 14 is a multiple of 7, which could be a clue (i.e. this sets the time per pixel).
I’ve started looking into arduino libraries that control time/date to schedule a long term day/night cycle, but I haven’t got my head around it all and found a simple solution to our problem.
- There is some recommendation in the strand test to add a 300-500ohm resistor and a 1000uF (microFarad) capacitor into the circuit to protect the neopixel from burning out. This might be a wise addition if we plan to run them long term.
Please see the code and some photos of our plantariums below!
here’s the code so far:
#include <Adafruit_NeoPixel.h>
#ifdef AVR
#include <avr/power.h>
#endif
#define PIN 6
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic ‘v1’ (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
// NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);
// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
// pixel power leads, add 300 - 500 Ohm resistor on first pixel’s data input
// and minimize distance between Arduino and first pixel. Avoid connecting
// on a live circuit…if you must, connect GND first.
void setup() {
strip.begin();
strip.show(); // Initialize all pixels to ‘off’
}
void loop() {
// Some example procedures showing how to display to the pixels:
colorWipe(strip.Color(255/4, 0, 0), 5); // Red
colorWipe(strip.Color(0, 255/4, 0), 5); // Green
colorWipe(strip.Color(0, 0, 255/4), 5); // Blue
colorWipe(strip.Color(255/4, 255/4, 255/4, 0), 1000); // White RGBW
colorWipe(strip.Color(0, 0, 0, 0), 1000); // Night
colorWipe(strip.Color(255/4, 255/4, 255/4, 0), 1000); // Day
colorWipe(strip.Color(0, 0, 0, 0), 1000); // Night
}
// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, c);
strip.show();
delay(wait);
}
}
Pavans-Plantarium
all-planatariums-closeup
all-plantariums-furtherout