New project help greatly needed!

Hi Guys,

I want to work on a new project and need a bit of guidance on what hardware I will require and if its even possible?

Heres what I want to achieve:

. A circuit is closed (using a button push or conductive ink ect.), Im guessing just a couple of pins on a breadboard?

. Arduino then reads the circuit is closed and converts it into an Ascii 2 code letter or number.

. The letter or number then gets sent to my PC & acts as a keyboard, which will trigger playback of an audio or video clip in resolume.

Any help really appreciated on this! If you need any further clarification please do let me know.

I need to know which bits of hardware I will need for this?

Many Thanks.

Lozzle: . A circuit is closed (using a button push or conductive ink ect.), Im guessing just a couple of pins on a breadboard?

. Arduino then reads the circuit is closed and converts it into an Ascii 2 code letter or number.

So in effect you want to take a binary value from the switch, a 0 or a 1, and convert it to an ASCII value? I hope you only want a choice of two ASCII values to convert to. ;)

(Oops. Posted before I finished.)

I guess that's what you mean by Ascii 2 code letter or number.

It's easy enough. We'll use 'A' and 'B' as the two ASCII codes, with an 'A' selected if the switch pin is high:-

char c;
if(digitalRead(pin))
    c = 'A';
else
    c = 'B';

Of course, this will continuously return one or the other of the values. You could possibly just decode or use the resulting character once if the switch changes states. That would require recording the switch state, then decoding if it changes. You might need switch debounce too. Really, you need a SPST switch to select the sound, then a pushbutton to send the selection.

You could do a search on "state machine" and "button debounce" to learn more.

You need a slightly better description of what you want. Edit: Oh, you added some more.

Anyway, I forgot to add, to actually send the ASCII character to the PC, you'd use 'Serial.print(c);'

Regarding triggering a sound on the PC, you need appropriate software that can receive the data then play a sound. You might want to look at 'Processing'. Maybe it could do that. I'm not sure.

Thanks for the quick reply and information.

I definitely need more than two states, ideally around 10! I will have a look at all the bits you described.

A little bit more information below:

. We will have a table with 6-10 buttons, with a projector mounted above the table.

. When a button is pressed it will play a sound or video via a program such as resolume.

I guess at this stage I just want to know if this is possible using ardunio and someone to code this? Or should I maybe look at using some alternative hardware/software?

Lozzle: Thanks for the quick reply and information. I definitely need more than two states, ideally around 10! I will have a look at all the bits you described. A little bit more information below: . We will have a table with 6-10 buttons, with a projector mounted above the table.

. When a button is pressed it will play a sound or video via a program such as resolume.

Right, now it makes more sense. Can "resolume", (which I've never heard of), accept serial input and play a sound file depending on the serial data it receives?

I guess at this stage I just want to know if this is possible using ardunio

Yes, it's very easy using an Arduino to watch for button presses, then send an ASCII character (or string) via serial with the character determined by which button is pressed.

and someone to code this?

If you just want someone to write the code for you, this is really the wrong section of the forums. You should ask a moderator to move this thread to the "Gigs and Collaborations" section of the forums. (You could click on "Report to moderator" to do this, and ask for the move in the text box.)

Or should I maybe look at using some alternative hardware/software?

Arduino is fine for the button press and serial communications part.

Edit: Some Arduinos have a native USB port, (the "Due" for example), and can act as a keyboard using libraries. This is probably the easiest way to go, if "Resolume" can be controlled by "hot keys". Anyway, if you want someone to write it, this can all be worked out in the other forum section when you find someone to do it.

Yes it's possible. Actually you may see it's quite straight forward once you understand the basics of how Arduino works and how it can be made to talk with a computer, be it a PC or a tablet.

Arduino reads keys It's program sends specific ascii characters for each key that is pressed. sends it via serial to PC. a PC program reads in keys the PC program plays music, movies, or any stuff that a PC is capable of (like sending predefined mails)

PC program may tell arduino to light leds, bulbs, turn on/off motors, etc.

If having a keyboard type interface is required (like you want to interface it with an existing PC program that can read only keyboard input) you can use certain types of arduino boards, that are able to simulate a USB keyboard . In this case you'll be somewhat limited at what PC program can tell arduino to do.


Don't know what resolume is, a link would be kind of you to share

Thanks guys,

Resolume is here:

https://resolume.com/ - Its essentially a media server for video & audio playback, mostly use for VJ’ing and projection mapping. You can assign keys to activate different layers/video clips.

I have have done a little more research and think there may be a different way to do this possibly?

It does not look like Resolume accepts serials inputs, however there is this software that can convert serial to Midi to activate video clips potentially?

http://projectgus.github.io/hairless-midiserial/#downloads

I am fairly new to all of this so please bare with me :slight_smile:

Lozzle:
Thanks guys,

Resolume is here:

https://resolume.com/ - Its essentially a media server for video & audio playback, mostly use for VJ’ing and projection mapping. You can assign keys to activate different layers/video clips.

I have have done a little more research and think there may be a different way to do this possibly?

It does not look like Resolume accepts serials inputs, however there is this software that can convert serial to Midi to activate video clips potentially?

The Hairless MIDI<->Serial Bridge

I am fairly new to all of this so please bare with me :slight_smile:

I know virtually nothing about MIDI, so can’t really comment except to say it looks like it would work.

This might help:-
http://playground.arduino.cc/Main/MIDILibrary
Again, I know nothing about this library, so you’d need to check it out. (Might be time to buy yourself an Arduino. Even an UNO could send MIDI commands using the “MIDI Library”, and you can get UNO clones for <$10 on eBay.)

It might be a fun project, and beats paying someone to write the code. :wink:

You've got me interested now, so I decided to make my own simple version of what you want. I don't really need it, but it'll be a good practice exercise. (I'll just make a temporary setup, then probably pull it apart again once I have it working.)

I'm not using "Resolume" or anything fancy, just using my default app for media files to open the selected files, (VLC media player for video and iTunes for MP3).

For my simple version, I'll set up a few buttons (or maybe a 4 x 4 matrix keypad) on the UNO to select media files, then send a serial ASCII string to the PC via a 433MHz RF transceiver.

At the PC end, another RF transceiver, then a simple custom app to decode the received strings and open the selected media file on the PC. I haven't written any C++ Windows code for a long time, and never for Windows 10, but just wrote a quickie that opens a media file when a button is pressed in the GUI. It works fine, so the rest is just legwork. (Using my (very) old C++ compiler and associated libraries, and even older coding skills, I thought I might run into problems writing code for Windows 10, but apparently not.)

This will keep me out of trouble for quite a while. :D

Wow thats amazing, thank you! Let me know how you get on :) :)

Lozzle:
Wow thats amazing, thank you! Let me know how you get on :slight_smile: :slight_smile:

It won’t happen very quickly. I just plan to do a little at a time, when I have a spare moment.
The Arduino side will be easy enough, but there’s a fair bit of work needed for the Windows app.
I’m just thinking out the details of the playlist at the moment. How to add and remove media files, how to store the playlist when I close the app, and how to relate the media files to the keypad buttons on the Arduino.
I might change things, but so far I’m planning something like this:-
Arduino PC Media Controller GUI.JPG

I couldn’t sleep, so got back up to do a bit more of it now. :slight_smile:

I’d like to eventually add “Pause”, “Play” and “Volume” controls, if I can work out how to do it at the PC end, but initially I’ll just make the basic version above.

Lozzle:
Wow thats amazing, thank you! Let me know how you get on :slight_smile: :slight_smile:

I got my simple version working. It works well.
I added a couple more controls than I originally planned. Here’s a screenshot of the GUI interface:-
Screenshot.JPG

And this is the UNO prototype circuit:-
Proto Circuit_sml.JPG

I can play media on the lounge room PC from any room in the house. The RF modules have a long range. If there was any purpose to it, I could control the media from the other side of the street. :slight_smile:

On the Arduino end, I have the keypad for media file selection, then five pushbuttons for control. The five buttons are “Pause/Resume”, “Volume Up”, “Volume down”, “Stop” and “Quit”.

On the GUI, “Save List” saves the media list to a text file, with each entry preceded by the keypad character that will play it. I can print the file, then keep a copy near the keypad, so I know which button corresponds to which media file.

Everything plays in the VLC media player, and the “Control” buttons send characters that are converted to virtual key codes to trigger the VLC “hotkeys”.

The media list can only hold 16 media files, (limited by the number of keypad buttons), but the files can be virtually any type of media file - videos, audio files or even complete playlists.

I’m pretty pleased with the way it came out. Now I have to decide whether to just pull it apart and move on, or continue and make a final version, (which I’ll probably never use).
I used my DIY I2C keypad for the prototype, which has an on-board ATtiny84 chip, but if I make a final version, I’ll skip the I2C keypad and just connect the keypad lines directly to an ATMega328P chip, to keep costs and size down.

The Arduino program is very basic, but I can’t say the same for the Windows app. The compiled executable weighs in at 224KB, and the *.cpp file alone has 1397 lines.
Due to my really old libraries and coding skills, on my Win10 machine I have to run the program in compatibility mode for Windows 8, but that doesn’t worry me. (At least I got it working.)

This was a fun project. Not sure what I’ll do with my spare time now. I might have to go ahead and complete the project, just for something to do while I think up my next project. :slight_smile:

This is the (very simple) Arduino code:-

/* APMC_Remote.ino
*  Written by Steve Carroll, 28.7.2016
*
*  Processor:- UNO / Mega2560
*  Notes:-
*  This program monitors the I2C keypad and 5 active-low pushbuttons, then when a keypad
*  or button press is detected, it sends the corresponding value to the PC at 9600 baud
*  via an APC220 433MHz RF transceiver.
*  The keypad returns a value between 0 and 15, corresponding to the key pressed.
*
*  *  *** I2C keypad I2C Address: 0x39 (57d)
*
*  Uses an APC220 433MHz RF module connected to the hardware serial port to send serial
*  communications - a qualifier, ("APM"), followed by a single data byte, (no line ending).
*  APC220 settings:-
*  Frequency: 432.5MHz
*  Serial baud rate: 9600
*  RF baud rate: 19200
*/

// Libraries:-
#include <Wire.h>

// Defines:-
#define KP_SLAVE_ADDRESS 0x39                   // The I2C keypad chip's I2C address. (57d)
#define DEBOUNCE_PERIOD 250                     // Button debounce, doubles as button repeat.

// Pin allocations:-
const byte ledPin = 13;                         // Internal LED on pin D13.
const byte bnExitPin = 2;                       // 'EXIT' button on D2. (Sends 'X')
const byte bnStopPin = 3;                       // 'STOP' button on D3. (Sends 'S')
const byte bnVolDownPin = 4;                    // 'VOLUME DOWN' button on D4. (Sends 'D')
const byte bnVolUpPin = 5;                      // 'VOLUME UP' button on D5. (Sends 'U')
const byte bnPlayPausePin = 6;                  // 'PLAY/PAUSE' button on D6. (Sends 'P')

// Global variables:-
unsigned long lastButtonTime = 0;

void setup()
{
    pinMode(ledPin, OUTPUT);
    digitalWrite(ledPin, 1);                    // LED flash on start-up.
    Wire.begin();                               // Join I2C bus (address optional for master)
    Serial.begin(9600);
    pinMode(bnExitPin, INPUT_PULLUP);
    pinMode(bnStopPin, INPUT_PULLUP);
    pinMode(bnVolDownPin, INPUT_PULLUP);
    pinMode(bnVolUpPin, INPUT_PULLUP);
    pinMode(bnPlayPausePin, INPUT_PULLUP);
    delay(500);                                 // Stretch the LED flash to make it visible.
    digitalWrite(ledPin, 0);                    // Turn LED off.

}

void loop()
{
    Wire.requestFrom(KP_SLAVE_ADDRESS, 1);  // Request the latest keypress byte from the I2C keypad.
    if (Wire.available())
    {
        byte keyPress = Wire.read();            // Returns 0-15, or 255 if no keypress.
        if (keyPress != 255)
        {
            Serial.print("APM");                // Send the 3-byte qualifier.
            Serial.write(keyPress);             // Send the keypad key index.
        }
    }

    unsigned long currentMillis = millis();     // Get the current 'millis()' time.
    if (currentMillis - lastButtonTime >= DEBOUNCE_PERIOD)
    {
        if (digitalRead(bnExitPin) == 0)        // Was the 'EXIT' button pressed?
            sendCode('X');
        if (digitalRead(bnStopPin) == 0)        // Was the 'STOP' button pressed?
            sendCode('S');
        if (digitalRead(bnVolDownPin) == 0)     // Was the 'VOL DOWN' button pressed?
            sendCode('D');
        if (digitalRead(bnVolUpPin) == 0)       // Was the 'VOL UP' button pressed?
            sendCode('U');
        if (digitalRead(bnPlayPausePin) == 0)   // Was the 'PLAY/PAUSE' button pressed?
            sendCode('P');
    }
}

void sendCode(byte bCode)
{
    lastButtonTime = millis();
    Serial.print("APM");                    // Send the 3-byte qualifier.
    Serial.write(bCode);                    // Send the button code.
}

Did you manage to get your setup under way? I’d be interested to hear how you’re going with it.