Atmega 32u4 Based Wireless USB Keyboard
How a generic keyboard is made has been already explained in the Atmega 32u4 Based Generic USB Keyboard Project. In this project a wireless keyboard will be designed. For making a wireless keyboard, there will be two circuits involved in the project – a transmitter circuit which will have a keypad included for getting the user input and a receiver circuit that will connect with the PC through USB port. The two circuits will connect wirelessly using NRF24lO1 module. The NRF module is a Wireless Transceiver that works on 2.4 GHz ISM (Industrial Scientific Medical) band. It is manufactured by Nordic Semiconductors.
The transmitter section will have Arduino Mega as the controller. The Arduino Mega is selected due to large number of GPIO pins available with board. So, if the project has to be expanded large number of keys can be interfaced to an Arduino Mega Board. At the transmitter section, the computation will be handled by two controller boards – Arduino UNO and Arduino Pro Micro, each having their own computational roles. At the end Arduino Pro Micro will connect with the USB port of the PC where the 8-bit USB AVR – Atmega 32u4 will work as the USB device controller chip. The Arduino Pro Micro will use AVR based Lightweight USB Framework (LUFA) as the firmware for implementing the USB protocol in the end phase of the project execution.
Usually the Windows keyboard has 104 keys which is the de facto standard and the windows based laptops have 86-key keyboards. An Apple keyboard has 109 keys as the standard and Apple laptops have 78-key keyboard. In this project a 4-key keyboard is built to demonstrate the making of wireless keyboard. The Arduino Pro Micro will use HID device driver class of LUFA framework for keyboard which will be modified to implement the project. With the use of LUFA firmware on Arduino Pro Micro, the device driver code to implement USB protocol is not needed to be written explicitly. The project works similar to any USB keyboard having wireless connectivity and has buttons for the following Inputs – :
• Input H Alphabet to the computer
• Input I Alphabet to the computer
• Turn Caps lock ON or OFF
• Left Shift Key
The transmitter circuit of the project uses tactile switches as the keyboard buttons, Arduino Mega for generating keycodes and NRF24LO1 for wireless connectivity. The receiver circuit of the project will use NRF24LO1 for receiving keycodes wirelessly, Arduino UNO to fetch and pass keycodes, Arduino Pro Micro to analyze keycodes and prepare HID keyboard specific data reports and USB cable to connect with the personal computer.
This project is based on Arduino Pro Micro, Arduino Mega and Arduino UNO which have AVR microcontrollers on board. In order to understand this project, one must have basic knowledge of the AVR microcontrollers and the embedded C programming for AVRs. WinAVR Studio is used to write, edit and compile the project code, so closely following the project shall require familiarizing with the above stated IDE as well. Though LUFA framework takes care of implementing the USB protocol on Arduino Pro Micro and has APIs to abstract the lower level codes, understanding USB protocol is recommended to understand how actually the project is working. In fact, if anyone has already worked on some other microcontroller and have some experience of working on electronic circuits, it will not be much pain to understand and follow this project. The project is based on getting input from the GPIO pins of AVR MCU, transmitting data through SPI, interfacing wireless module with Arduino(s) and modifying the LUFA device driver for keyboard functionality.
1. Arduino Pro Micro
2. Arduino Mega
3. Arduino UNO
5. Connecting wires
6. Push buttons
7. Micro USB cable
8. 10K resistors
9. NRF24LO1 Transmitter and Receiver
SOFTWARE TOOLS REQUIRED
1. WinAVR Studio
2. AVR Dude
The project will have two circuits – Transmitter Circuit and the Receiver Circuit. The Transmitter will have following hardware blocks – :
• Keys – The push buttons will be used as keyboard keys. There will be four keys: h alphabet key, I alphabet key, Caps Lock key and Left Shift key. The Push buttons will be attached to Arduino Mega via Digital Input/Output pins. The switches will be interfaced to the pins of the Arduino Mega in the following manner
The tactile switches are connected between the pins and the ground. The pins by default are connected to VCC and receive a HIGH logic. Pressing a tactile switch changes the status at the respective pin to LOW by short circuiting to the ground.
• Arduino Mega – The Arduino Mega will be the controller board at the transmitter end. The NRF will be interfaced with Arduino to add the wireless functionality. Push buttons that will work as keys will be attached to the GPIO pins of the Arduino. The Arduino Mega has more input pins than other boards, which makes it suitable for connecting large number of keys. Therefore, on Arduino Mega, the project can be expanded from four keys to a significant number of additional keys.
• NRF – The NRF24LO1 will be interfaced with the Arduino Mega via SPI (Serial Peripheral Interface). It will be used to transmit data wirelessly to receiver. The NRF module will be interfaced to the Arduino Mega by connecting the pins in the following manner -:
Read More: Atmega 32u4 Based Wireless USB Keyboard
Leave a Comment
You must be logged in to post a comment.