Absoulte newb, making a HID dj controller.

Hi to everyone, I'm brand new to prototyping but I do know a considerable bit about electricity (I am an electrician)

I am wanting to make a HID dj controller (I'd rather not MIDI), that will talk to the virtual dj software (or Traktor etc)

I've found some blueprints that involve multiplexers, port expanders, 50 switches and 20 pots. but I think it would be good if I started with 1 potentiometer on A0

Is there any recommended reading for HID projects, and how to have my uno recognised as HID?

Thanks in advanced.

Maybe:

Welcome!

Ray

mrburnette:
Maybe:
Getting started with Arduino! – Chapter Zero | tronixstuff.com
Welcome!
Ray

Thanks for the link, that will come in useful later but HID joystick seems more fitting,

I have learnt I have to change the UNO SMD R3's firmware by putting it into DFU mode, but now am starting to suffer from information overload, anyway I'll keep reading.

*edit I found this, this purports to put the board into DFU mode, I am assuming this is done live?

Razorblade:

all that's needed to enter DFU mode is to briefly short enough to short pins 5 and 6 of the 8U2 icsp connector

Pins 5 and 6 are circled in red in this picture:

Anyway, still reading... How to flash the firmware next.

*further edit

I found flip is the program, for flashing with windows.

So now I suppose I try.

If you want some character-based HID fun:
http://forum.arduino.cc/index.php?topic=195003.0

Ray

Eugh!! this is too much confusing reading for something so simple

I needed to put the board into dfu mode and then I needed to update the drivers for flip work.

the drivers are found C:\Program Files\Atmel\Flip 3.4.5\usb

...continue reading...

I have learnt I have to change the UNO SMD R3's firmware by putting it into DFU mode, but now am starting to suffer from information overload

Two years of playing with my 5 UNOs and I have never put it into DFU mode... Why? It sounds like it hurts =(

Just be careful, you can brick a good 16U2

Ray

Well after a day I'm now somewhat familiar with DFU (it stands for Don't f ]:slight_smile: ]:)k up) I had it putting out a pre programmed output, and that was detectable within my dj program , and thankfully I returned the Uno back to normal.
Tomorrow I'll try a analogue input.

I've tried the analogue example from the learning section here and I've also used the demo program from my joystick tutorial, but I can't combine the two effectively,

I am just wanting the pot on A0 to change x, what is written maybe rubbish, but I'm guessing it can't be that far wrong, any help please?

const int x = A0;

struct {
    int8_t x;
    int8_t y;
    uint8_t buttons;
    uint8_t rfu; 	/* reserved for future use */
} joyReport;

void setup();
void loop();



void setup() 
{
    Serial.begin(115200);
    delay(200);
}

void loop() 
{
    int ind;
    delay(5000);

    joyReport.buttons = 0;
    joyReport.x = 0;
    joyReport.y = 0;
    joyReport.rfu = 0;

    Serial.write((uint8_t *)&joyReport, 4);
    
}

The ATmel uC is a single-core device and does not support multithreading. So

delay(5000);

is going to completely stall the uC for 5 seconds.

The Blink without delay example that comes with Arduino is suppose to teach how to use internal timers and a few variables to create a delay mechanism that does not stall the core. There are also a few good state-machine examples in the forum.

Everyone approaches this somewhat differently, but play around and do some searches and pick a style that you are comfortable using.

Ray

Well yes, but why did you choose that snippet to give me advice on?

It was a remnant from the demo sketch that proves HID output, but whatever,

I have done the analogue example, just telling me to read is no good,
I am at the very beginning All I want is 1 pot on A0 to output as a HID device, I can do it as a normal serial monitor exercise, and I have proven HID automated output with a demo program , I'm just struggling to transferee from automated to analogue input
I'm sure it is something very simple to do, possibly just declaring a variable and a pin or something that would take you 1 minute to instruct me, Is it really better for me to read for several hours for something simple.

If you helped me then I would have something to start to understand,
example looks like this
HID looks like that

This is the Automatic HID output code

struct {
    int8_t x;
    int8_t y;
    uint8_t buttons;
    uint8_t rfu; 	/* reserved for future use */
} joyReport;

void setup();
void loop();

void setup() 
{
    Serial.begin(115200);
    delay(200);
}

/* Move the joystick in a clockwise square every 5 seconds,
 * and press button 1 then button 2.
 */
void loop() 
{
    int ind;
    delay(5000);

    joyReport.buttons = 0;
    joyReport.x = 0;
    joyReport.y = 0;
    joyReport.rfu = 0;

    /* Move the joystick in a clockwise direction */
    joyReport.x = 100;
    Serial.write((uint8_t *)&joyReport, 4);
    delay(1000);

    joyReport.x = 0;
    joyReport.y = 100;
    Serial.write((uint8_t *)&joyReport, 4);
    delay(1000);

    joyReport.x = -100;
    joyReport.y = 0;
    Serial.write((uint8_t *)&joyReport, 4);
    delay(1000);

    joyReport.x = 0;
    joyReport.y = -100;
    Serial.write((uint8_t *)&joyReport, 4);
    delay(1000);

    /* Send button 1 then button 2 */
    joyReport.y = 0;
    joyReport.buttons = 1;
    Serial.write((uint8_t *)&joyReport, 4);
    delay(1000);

    joyReport.buttons = 2;
    Serial.write((uint8_t *)&joyReport, 4);
    delay(1000);
    
    joyReport.buttons = 0;
    Serial.write((uint8_t *)&joyReport, 4); 
}

Thanks for your patience.

If you helped me then I would have something to start to understand,

The first link I gave on HID, for fun, linked to this String numeric output with V-USB HID - Exhibition / Gallery - Arduino Forum
On that link, is the code for posting all 6 of the UNO Analog readings to the PC... down in reply #3.
Snippet:

    for (int i = 0; i < 6; i++){
      // read the analog in value:
      sensorValue = analogRead( i );
      // Label the value
      sOut = "ANALOG";
      // String the characters together
      sOut.concat(String(i));
      sOut.concat(" ");
      sOut.concat(String(sensorValue));
      // spool the combined strings
      KeyStrokeAlpNum(sOut);
      UsbKeyboard.sendKeyStroke(KEY_ENTER);
    }

So, you can use a 10K potentiometer from +5 to Gnd with the wipper on any Ax pin. Just incorporate the above into you current HID code.

Ray

Thanks ray,

The UnoJoy is brilliant, it's well commented and it also tells you how to expand/rewrite the firmware for more buttons or inputs, I wish I had found it 2 days ago, (my pots now control my Virtual dj software)