I've been exploring the electrical abilities of littleBits modules for a year and they are great for quickly building electronic gadgets and devices. I've used these awesome electronic modules in several Career and Technical Education (CTE) courses I teach at local Alabama technology high schools and a community college. I also provided several littleBits projects in my recent Arduino Electronics Blueprints book published by Packt Publishing. In this book, the littleBits projects illustrated basic circuit interfacing techniques for buidling awesome Arduino devices.
The library of littleBits modules allows a variety of electronic devices to be built easily: no soldering of electronic components onto perfboards or PCBs is required. The two major requirements in using littleBits are the willingness to have fun and be creative. In this continuing Building Raspberry Pi Controller series, you will learn how littleBits modules can be wired to a RPi by building a simple IR remote activated event counter.
Final Hardware Build
You successfully built the remote trigger interface circuit and it's ready for the final hardware build of the the project. As discussed previously, a second proto module will be used to wire the littleBits number module to the RPi. In order for the wiring connection to occur, a transistor circuit is needed. In the previous Building RPi Controllers project, I discussed the transistor switch and how it operates a small DC motor. The same electrical wiring technique used in the object detection DC motor controller project will be used to operate the littleBits number module. With the remaining components left from the Project Parts List, build the transistor-littleBits number driver circuit using the wiring diagram shown next.
Again, I included a circuit schematic diagram of the driver circuit as an additional reference for the intermediate to advanced electronics maker.
Before adding the final Python code to the RPi, check the transistor driver circuit wiring carefully. With no wiring errors found, you have completed the final build of the IR Event Counter. To provide a rigid circuit platform for the littleBits modules, you can place them on the mounting board. I provided a picture of my assembled IR remote event counter using the littleBits mounting board. The only activity remaining is installing and running the IR Remote Event Counter Python code.
The IR Remote Event Counter
The final step to completing this cool RPi controller project is to install and run the Python code. The Python code shown below is a program re-use from the pushbutton project. The variable names were changed to reflect the physical components wired to the RPi. The code works by pressing any button on an ordinary IR remote to increment the value on the littleBits number module. With every button pressed on the remote, the number display will increment its value by one.
The entire Python program can be typed onto the LXTerminal by opening the nano editor with the linux command ~sudo nano IREventCounter.py. Also, the python program can be saved on your RPi's SD card by clicking the code button below. With the IR event counter Python code entered into the LX Terminal, type the Linux command ~sudo python IREventCounter.py after the prompt onto the screen. Take an IR handheld remote and point it at the remote trigger. Press any button on the handheld remote and the littleBits number module will begin to increment. Congratulations on building another RPI Controller successfully! You now have a functioning event counter to experiment with. The RPi also prints the state of the counter on a monitor's screen with each button press as well.
Explore the operation of the littleBits number module by moving the slide switch to the various function positions on the board. As always, record your observations in a lab notebook. An application that comes to mind for the IR Remote Event Counter is keeping score for a game or sporting event, but you can explore other applications of your own using this awesome electronic counter. Next time, we'll investigate how to read analog data with an RPi.
branko.j.kovac
2017/2/9 4:18:06
Great thanks for your helpful info. Really useful.