Skip to main content

Implementation 2 - use arduino uno acting as keyboard



concept: 

Function A (input) performed by an arduino uno connected through USB and acting as a keyboard.

Other function B C D actions performed by the same java programme as in first implementation.

Image of hardware setup: Arduino wwith switches, USB link,

Story

In this implementation, we try to separate the input device from the device finally being controlled and performing the actions. Arduino uno is fitted with 5 inputs. To start with these inputs are switches. These switches are treated exactly as the keyboard keys in the first implementation.
the switch pressed is considered as the 'keydown' event.
Arduino sends the USB code representing a combination of keys pressed ( max 6 keys can be pressed simultaneously together).
On the host side, the program still listens to key pressed and builds the "words" according to the rhythm at which the switches are pressed.
Arduino code

Specific trick to have Arduino Uno seen as a  keyboard by a computer

Some Arduinos allow the use of library xxxx that will make the Arduino to send commands recognised as standard Human Input Device (in this case a keyboard)

Arduino Uno does not support such library.
A way around consists in changing the firmware of the Arduino to a firmware that mimics a keyboard.
Code implementation needs to be done using the standard Arduion firmware. Running the code is done using a "keyboard firmware"

link to page explaining how to

Tried on following platforms : macbook with osx, ...

Alternative input sensors

Alternatively to the switches, microphones were also used. Input is detected when the user taps on the microphone and the value returned by the microphone is the max value.
Hardware
microphone board
Software
Whenever a max value is detected on the output of the mic sensor, the input is digitalized and a variable is set at "1" for a period of time. The input is detected by a loop looking for changes from 0 to 1 in this variabl ( on rising edge).
Arduino code

Alternative input sensors to be tested

light switches

light beams

piezo sensors

capacitive sensors

others ...


Comments

Popular posts from this blog

Processing - playing with particles collections

Colourful ant-like particles description  Particles created, move, interact, grow from encounters and disappear. click and drag to create new particles Processing code: Automated vehicles reaching target and avoiding obstacles  description  Processing code: Coil spring description Processing code: Spring 2D description Processing code:

Implementation 3 - use arduino uno and bluetooth link

concept:  Function A (input) performed by an arduino uno connected through bluetooth as using a serial communication. Other function B C D actions performed by a java programme. Image of hardware setup: Arduino with switches, bluetooth adapter, serial link The main benefits of this configuration is that the keyboard is not needed anymore as a link in the input chain. The host can then listen to the bluetooth data sent in the background, while the keyboard is being used for different purpose. Also, the application on the host does not need anymore to have the focus. Last, the input device can be split from the host computer or device.

Processing - drawing interface good for kids

Drawing interface using processing 3 Description This sketch allows to draw shapes simply. Click once to activate the pen. An initial color is selected. Press an arrow button to select color and mix cyan, magenta, yellow, black using arrows. Press SPACE to get back to drawing. Draw as long as the pen is activated moving the mouse. Then click again to deactivate the pen. Each line can be erased by pressing SPACE. Erasing takes place in the reverse order of it being drawn. code Processing:

Arduino projects, sensors and actuators

Moving average on analog input Description This small project shows how to implement a moving average with a lightweight form in order to smooth raw analog values. The value is then used to position a servo Image code Arduino: Using Ultrasonic sensor  Description In this project, we are using a US sensor. Very first step to understand the behaviour of the sensor through the serial interface. Image code Arduino:

Home Automation - Garage Door Security

Description: This is the research project to understand the home automation system which I would like to develop when I'm building my own house in the future. Burglary is a common threat while living in South Auckland. My wife's mountain bike was stolen from the garage in our first year living in the South Auckland. Even though we have moved to different house and living in better neighbourhood now, always worried and paranoid about the garage door. So this project developed to monitor the garage door and alert if the door is open. Some of the terminology used in this post:  Home Assistant -  Home Assistant is an open-source home automation platform running on Python 3. Track and control all devices at home and automate control.  Many components are supported well by Home assistant community (Wemo, Amazon Echo, Google Home, Google Assistant, Zigbee, MQTT, IFTT, etc..) MQTT (aka MQ Telemetry Transport) is a machine-to-machine or “Internet of Things” conn...

Drive your lego model by voice

Voice controlled Lego merry-go-round Build a model using lego and a motor Drive the motor at various speed using an arduino board as variable frequency drive Send commands to the arduino board using your voice, through a Processing sketch on your computer and bluetooth That's it, and it works Description   hardware  A Lego motor - old motor from Lego technics - DC current - 4.5V Arduino - Uno in our case Bluetooth board - ref  Transistor Diode Breadboard and jumper cables Arduino code : Processing code :

Implementation 1 - java based rhythmic listener and interpreter

All 4 steps performed by a java programme Java was selected since it allows one programme to run independently of the platform, Windows, OSX, Linux. A The user can perform a rhythm using up to 5dedicated  keys on the keyboard. B, J, K, L, M were selected since they fall easily enough under the fingers of a right handed user. Entries are performed in a way close to playing keys and chords on a piano keyboard. B keystrokes on the dedicated keys are converted into "chords" and "phrases" "Chord" represents the keys that are pressed simultaneously - it is basically an array of 5, with values 1 or 0. "Phrase" represents a group of chords separated by a variable interval. This is the actual rhythmic pattern. The length of the interval between chords is recorded using a number. The shortest interval is given the value 1, the other intervals are given a multiple (2 if the interval is twice as long as the shortest in the phrase, ...) Th...

ABC game - letters sounds and rhymes

Audio interactive game for kids around letters and numbers learning Description Toddlers are attracted to computers, they want to play with it, press the keyboard all the time when their parents use it - pretty much for everything.  I was browsing the web for games designed to help kids learn their letters and ABC when I decided to take the opportunity to build a simple game allowing the child to discover the letters, while taking an active role in building the game it self. Here is the concept: The game displays a letter and at the same time plays an audio relating to the letter. If the player presses the right key at the first attempt, a congratulation sound is played and lots of progress is made. If the right letter / character is found after several attempts, less progress is made, no congrats sound is played. The child or the parents can record every sound matching the letters as well as the congrats messages. I got my daughter to record a short voice memo to ma...

Smart temperature sensor and client interface

Wifi enabled temperature and humidity sensor and client sending email notifications description This project was developed as part of a research to build a temperature automation system for our charming but cold Auckland home. Relying on electric oil heaters as sole source of heating in children's room, the aim was to monitor continuously the temperature at night and to turn on or off the heater according to the measured temperature. The project described in this post does the first half and mode demanding part of the job which is log a temperature, broadcast it to the web using the MQTT protocol through the house's wifi. A small and cheap ESP8266 Wifi board programmes using the Arduino language reads temperature and humidity through an DHT22 sensor and broadcasts the values to an MQTT server at set intervals. A custom client written in the java based Processing 3 and running on a computer located anywhere (Macbook in this case) displays the readings and sends not...

Rhythmic interface with machines

Introduction Many forms of human user interfaces are available to interact with electronic devices. Most commons ones use a keyboard and mouse and touch screens. Voice interface is developing and gaining momentum. This project was started from the observation that most commonly used HID require that the user has a visual contact with the interface device (applies in particular with touch devices like smartphones and tablets, also with keyboards). Some common or recurring tasks however could be completed without a visual contact with the device if the interface was designed for that. These task include launching a specific app, opening a file, writing a standard text... The project will explore an ancient and yet rich, not to say endless means of communication which are rhythms. Drums have been used to carry messages between villages. Some people living in rural areas use song and whistle as  a second specialist second language to communicate on a longer dist...