Sunday, April 15, 2018

Feathers of a Birds

I got talked into doing lights on "Conference of the Birds." And the way the timing worked out, hit just when BOTH a big project at work and a nasty cold did.

I wanted a remote controlled lighting effect and had no time...but you know, the existing Feather RFM69 board is pretty nice. USB native both for programming and HID/USB-MIDI devices. Hosted 915mHz (unlicensed band) packet radio with a hundred-meter free air range -- and ten bucks more gets you to LoRa radio chip that will get a couple kilometers with good antenna.

And went for another Adafruit product, a NeoPixel "Jewel" sporting a cluster of seven RGBW LEDs. These are those small form-factor LEDs with WS8212 chips included under the plastic so they handle stand-alone PWM, current limiting, and serial communication all by their lonesome. Even running two color channels full out, though, the full Jewel is a bit shy of the 350mA a single "1 watt" Cree will do. Still, since human perception is more-or-less power law, you'd have to throw at least 3 watts to notice an appreciable increase in brightness over what the Jewel can do.

Programming, however, has been slow. Not that it is easy to program through a sinus headache, anyhow.

First task was getting the Feather board to talk to the Arduino IDE. Patched the board definitions in no problem. Was a little slower picking the right board, as the literature wasn't always clear which was the 34u and which was the "MO" board. Exacerbated by the fact that there was in the current version some deep-buried call to a different library.

I finally figured it out by running the programmer in verbose mode and picking through the error logs, then searching archives to find the missing library.

Second task was getting the lights to light. There's an increasingly common problem with Arduino compatibles. The pin definitions in the IDE were written around the ATMega chips. When you translate to a different chip, and that different chip is on a different breakout board, you have chip pin, board pin, port number, and IO pin and they don't line up in any logical way with IDE pin. So there's a fair amount of trying out different pin numbers until the connected hardware finally responds.

And then there was testing the radios. Pretty much installed the library, loaded the demo sketches, and they seemed to run.



The next session was...slower.

I raided my parts box and I just don't have enough buttons. And Radio Shack is no more (with tech this weekend, Digikey was not an option). Fortunately I had an old matrix keypad lying around, and I found a library for it (I could roll my own software and it might have, as it ended up, taken less time).

Thing is, some of the pins are reserved for the RFM69 module, some for USB, plus some available IO pins lack the internal pull-up resistors. Meaning I was back to the soldering iron two or three times changing which pins I was using. And lots of commenting out lines and re-uploading software until I'd found what was causing it to lock up on me.

With that done, into the radio to try to get it to pass on the button ID. And that was a horrible hassle. I miss the XBee modules, even if you did have to roll out a special programer and speak AT code at them. I kept commenting out sections of code that shouldn't have done anything -- like serial print calls which just print status reports to screen -- and then finding the radio wouldn't run.

So it's a big cludge now for the radio stuff, and I really don't have time or patience to clean all that up. I still have yet to write the different "looks" I'll be switching to. Hopefully, though, I'll be able to cut and paste my own software from the Holocron and similar for that.

No comments:

Post a Comment