Welcome back to andidinata.com, with this opportunity i would like to share a real life problem solving with Circuit Python. If this is your first time to hear about Circuit Python, there are tons of information on the internet. Jump to adafruit learning system to find more.
Let’s get started. I changed job since beginning of March 2019 and in my new place, the printer is not used the same way as my previous place.
In my previous place, i used to tap my RFID-enabled ID Card to collect the printings. So I could send document securely over the printing server and collect them immediately or later at virtually any printers on tap. This way I had no worry if my printing to be found/read unintentionally by somebody who might be actually digging in to the pile of printings to find theirs.
Secondly, to save the use of paper, my current place load one-side-used papers. But for some documents, a new paper should be used. And therefore i have to “announce” to the whole workplace that i am going to use the printer with new paper. I do that every time to put their intention to print on hold for a while.
I am not complaining. But instead, i’m trying to make it easier for me.
So, this idea came after realizing that Adafruit Circuit Playground Express (CPX) is stuffed with all cool things, sensors and actuators and infrared transmitter & receiver. So far i played with IR receiver and transmitter only for fun. But this time, I can make it work for business. So, here is the idea to deal with my problem:
I stand next to printer and holding a remote control. Then i point the remote to the CPX then press a button. On keypress, CPX instructs the Excel/Word/Powerpoint to print. I hear the printer starts working, i collect the printing and done.
Top line, this is how it is done:
- Get the IR receiver on CPX to work with pulseio library
- Decode the remote control message to make it human readable. This sounds cool. But adafruit_irremote library is so easy, letting me to do it just 1 lines long.
- Record the IR message in a form of python dictionary key for easy value lookup.
- Call adafruit_hid library to let CPX to be recognized as USB keyboard. We need two functions keycode to translate the keypress to a numerical data and keyboard to emulate the numerical data so client computer will read the message as it is typed by physical keyboard.
- That simple? Yes, that simple.
About The Remote Control
Any remote control at home i found to work with CPX. Like AC, TV, DSLR shutter, home/car audio/video system, lcd/display module. For this project i use a tiny remote from display module i bought from AliExpress. It has 6 keys. 4 directional button, 1 center and 1 power button. This short-range little remote will be my problem solver.
The 4 directional button will act like keyboard arrow button. Center button is the ENTER key and Red button is ESC key. Those are essentials command for navigation. It works really effective both in workplace and at home.
//www.instagram.com/embed.jsView this post on Instagram
Real-life problem is solved I used to tap RFID card to print, so i could collect my doc that may use specific paper or contain specific content. My new place has not implemented it so i have to tell everybody before I start to print. To solve that, i use IR remote control (literally any remote for home appliance). Now i have the same process as before. I stand next to the printer, point the remote to CPX and press a button. @adafruit CPX will translate the message and tell computer to print. Then printer starts to work while I am there to collect 😄 This works seamlessly to any computers. Just plug the USB in, including to my little KODI running on Pi Zero. #circuitplayground #circuitpython #micropython #circuitplaygroundexpress #adafruit #microcontroller #problemsolving #embeddedsystem #raspberrypi #pizero #kodi #arduino #coding #diyelectronics
The code is available in my github page. (www.github.com/mdinata/circuitpython).
Thank you for reading and i hope you find this post useful. Until next time.