====================================================== Snakes on a Bookshelf : MicroPython for Bibliophiles ====================================================== .. todo:: This article is a work-in-progress. In this article, I'll showcase the bookshelf LEDs that I've set up for the search engine. I'll not go into too much detail here, since that will be part of a series of posts on the Shelfie project. .. admonition:: Foreword My photography skills leave much to be desired. I'll have to retake some of these photographs so that I can present this project better. I am a voracious reader. Unlike most people, I read paragraphs at a glance when I'm in the mood for it, not lines or words. That helps me read about 500-800 pages in two or three hours. I've been buying a lot of books, and I read widely and across a varied set of genres. I *think* I have 900 books. I am not quite sure. It is hard to count, sometimes. .. figure:: ../_static/shelfie/shelf/001.jpg :width: 500 I **love** books. I have a lot of them. .. figure:: ../_static/shelfie/shelf/002.jpg :width: 500 I mean, a **lot.** .. figure:: ../_static/shelfie/shelf/003.jpg :width: 500 No really. .. figure:: ../_static/shelfie/shelf/004.jpg :width: 500 **Really.** .. figure:: ../_static/shelfie/shelf/005.jpg :width: 500 You seem to think I'm kidding. .. figure:: ../_static/shelfie/shelf/006.jpg :width: 500 I most definitely **am** not. .. figure:: ../_static/shelfie/shelf/007.jpg :width: 500 So you see, you understand what I mean. .. figure:: ../_static/shelfie/shelf/008.jpg :width: 500 I should count all these, one day. .. figure:: ../_static/shelfie/shelf/009.jpg :width: 500 That day can't come soon enough. It becomes hard to find books sometimes. Case in point: I own two copies of several books. To solve this problem, I decided to blend my love for Python, and my love for books into one. I discovered the ESP8266 nodemcu chip a while ago, and it proved to be really easy to set up. So, using that idea, I decided to look up what I could build with a couple of them. This article won't go into the intricacies of the project, because I plan on describing it further in a series of articles. However, here I plan on describing my thought process while I was prototyping this project. --------------------- Call Me Trippy --------------------- The first step, was sticking a series of WS2812B addressable LED strips along the sides of the bookshelf. This was a little easier where the top of the bookshelves were concerned. I was lucky that the total length was *just* under 5m. I used cellophane tape to secure the strips. I probably should have used double-sided cellophane tape, but so far, the ordinary tape has secured it in place. .. figure:: ../_static/shelfie/bookshelf_leds.jpg :width: 500 Step 1: The WS2812B LEDs --------------------- Hello, MicroPython! --------------------- Once the LED strips were in place, the first plan of action was to get it working. I used the NODEMCU to drive the LED strip. Turns out, I needed a load-shifter to convert the 3.3V signal from the NODEMCU to 5V required by the LED strip. .. raw:: html
-------------------- I Like 'em Blues -------------------- I had to cut and resolder the LED strips for the insides of the bookshelf, a feat easier said than done, because I'd never touched a solder-iron before. .. figure:: ../_static/shelfie/inner.jpg :width: 500 The blue light made the bookshelf look rather legit. -------------------------- What's Capacitance, Doc? -------------------------- I never really paid attention during Electronics class. So I seemed to have goofed up where the circuit was concerned. I seemed to have gotten something wrong with the circuit, and it turns out that I needed a 100µF capacitor between the inputs to the LED strip. .. raw:: html -------------------------------- Let Me Worm My Way Out Of This -------------------------------- Once half-way there, I could slowly control the timing with a little precision. That allowed some interesting hijinks. .. raw:: html ----------------------------------- How Long Does This Take? ----------------------------------- But I kept having the same problems, over and over again. Sometimes, the circuit worked, and at other times, it did not. .. raw:: --------------------------- *Et, Voila!* --------------------------- But once I managed to figure out the circuit's power requirements, I had *exactly* what I wanted. .. raw:: html -------------------------- Next Steps -------------------------- I need to organize this project better. This is where the *Vial* project stemmed from, and fulfilling that project will help the realization of the *Shelfie* project. -------------------------------------- Shelfie, The Bookshelf Search Engine -------------------------------------- Shelfie is powered by Raspberry Pis, CouchDB, MicroPython, NodeMCUs, Flask, Vial, RabbitMQ and the WS2812B LEDs.