Controlling Hexabitz RGB LED Module Using 4x3 Keypad Via Raspberry Pi

by Aula Jazmati in Circuits > Raspberry Pi

348 Views, 2 Favorites, 0 Comments

Controlling Hexabitz RGB LED Module Using 4x3 Keypad Via Raspberry Pi

IMG_20210404_183944.jpg

In this tutorial, I will show the connection of such a keypad matrix and how to easily read them with the GPIOs.
Then I use it for controlling Hexabitz RGB lED module via Raspberry Pi interface module.

A small keypad is a convenient way of providing users of your custom projects with a way to interact with the system or any game ❀(✿◠‿◠)❀

Supplies

H01R0 (RGB Led Module)

IMG_20210413_123851.jpg
gdfgd.PNG
ldkmvld.PNG
dlfksd.PNG
dkvld.PNG
dkmfld.PNG
ldfcds.PNG

H01R0x is a smart RGB LED module based on Cree CLVBA-FKA RGB LED and STM32F0 MCU.

HF1R0(Hexabitz Raspberry Pi Interface Module)

03-vb22 ‫‬p1 ‫‬-How to Connect to a Raspberry Pi.png
04-vb22 ‫‬p1 ‫‬.png
14-vb22 ‫‬p1 ‫‬.png
05-vb22 ‫‬p1 ‫‬.png
16-vb22 ‫‬p1 ‫‬.png
17-vb22 ‫‬p1 ‫‬.png
18-vb22 ‫‬p1 ‫‬.png

HF1R0x is Hexabitz Raspberry Pi interface module

  • HF1R0x module enables you to seamlessly interface your Hexabitz modules to a Raspberry Pi 3B/3B+/4B single-board computer.
  • Small form-factor with options to connect Hexabitz modules all-around the interface and power the modules from Raspberry Pi on-board 3.3V supply and most of GPIOs is free to use with anything (except tx\rx GPIO) .
  • Use C++ Hexabitz Interface library on Raspbian, Ubuntu or other compatible Linux distributions from within your C++ or Python applications.
  • HF1R0 is an open source project which enables the community to use the projects that are available off-the shelf, make your own projects using the library core or modify the library for your own custom needs and requirements.

Hardware Design and Implementation

ErJ1eLXXMAArla6.jpg

Plan the array and assemble the hardware

Connect the RGB LEDs Module to HF1R0 module.

Take your Hexabitz module and HF1R0 module and solder them together using Hexabitz Fixture.

Be sure to download the firmware on the module before soldering.

https://hexabitz.com/docs/how-to/update-module-fir...
Installing Pi operating system -Raspbian Buster with desktop and recommended software-image and Writing an image to the SD card

https://www.raspberrypi.org/documentation/installa...

Python Pyserial

2021-03-11-223821_640x480_scrot.png

This module encapsulates the access for the serial port. It provides backends for Python running on Windows, OSX, Linux, BSD (possibly any POSIX compliant system) and IronPython. The module named “serial” automatically selects the appropriate backend.

Depending on the version of python, there are several commands to install the package pyserial.
sudo apt-get install python-serial python3-serial

Python code to read the serial port:

This section of code primarily instantiates the serial class, setting it up with all the various bits of information that it needs to make the connection with.

port – This defines the serial port that the object should try and do read and writes over.

baudrate – This is the rate at which information is transferred over a communication channel.

parity – Sets whether we should be doing parity checking, this is for ensuring accurate data transmission between nodes during communication.

stopbits – This is the pattern of bits to expect which indicates the end of a character or the data transmission. bytesize – This is the number of data bits. timeout – This is the amount of time that serial commands should wait for before timing out. import serial

import serial
ser = serial.Serial( port='/dev/ttyUSB0', baudrate = 921600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=1 )

Notes

Raspberry_Pi_Keypad_Numpad_3x4_Steckplatine.png

It’s easy to connect a simple keypad to a Raspberry Pi and provide Hexabitz users with a convenient way to input data and interact with your custom Raspberry Pi based projects. The keypad only requires a few digital I/O pins to operate.

The Raspberry Pi doesn’t need to supply the keypad with a power source, as the key-matrix solely consists of simple push buttons.

The Raspberry Pi sends pulses to each row of the keypad’s internal matrix, and when a user pushes down on a button, the button closes a contact that connects a single row to a single column. The Raspberry Pi listens to changes in the column signals, and when it detects one, the software can decode which button the user pressed. This procedure is easy to implement in any programming language supported by the Raspberry Pi 😃

My Code:

IMG_20210404_183933.jpg

My code:
https://gist.github.com/aula9/4306ce529d1f40d91824ec21e410af17

The project is under development