Which Arduino should I chose?
However, when looking at the library functions, I see for example no method to send mouse scroll commands.
How do I get started? My idea is to put something in between the keyboard and the laptop, and then use a multimeter to measure the signals that get emitted when a key is pressed. Only afterwards, I would connect the keyboard to the Arduino.
Probably a Mega2560 to read the whole Keyboard. You can program the ATmega16U2 on the board to do the same as the Leonardo is doing, you just have to define a serial protocol between them.
You can try a Leonardo with some additional hardware (shift-in/-out registers may work) but be prepared that this gets a bit more complex.
My guess is that a multimeter isn't fast enough.
You need something like a scope
Thanks for the suggestion. Just to make sure: What is "them", the ATmega2560 and the ATmega16U2?
Is writing that serial communication straight forward? Has someone done this before?
How about a Due?
I don't expect there to be just some quick signal.
In the worst case, I have to connect the keyboard directly to the Arduino, right from the beginning.
The Due is able to do that but might be a bit expensive for the task.
As I wrote, I expect it to be wired as a matrix, so the controller will turn on one row, read all column inputs and turns that row off again to turn on the next row.
It's a tedious job but if you connect the Arduino from the beginning chances are quite high you fry your GPIOs.
Phew, that would be complicated. I was expecting that one key press corresponds to current flowing over two pins, one for column, the other one for row.
I wonder whether it would be easier to simply get a dedicated keyboard controller, such as the KeyWarrior. I could let that convert keyboard signals to PS/2, and then pipe them into the Arduino, together with the mouse PS/2 signals. Then the Arduino would take care of configuring the TrackPoint (mouse) on key press, and for converting PS/2 signals to USB.
That would be a problem if two (or more) keys are hit together. You cannot distinguish which are actually pushed down.
KeyWarriors all know USB and you can buy a cheap PS/2 to USB converter for the TrackPoint.
[TrackPoint PS/2]------------------\ ====[Arduino]====[PS/2-to-USB converter]----[HID input][keyboard]----[KeyWarrior PS/2]----/
I thought you want to do it with an Arduino
If it's reasonably straight forward, then I would be interested in doing all inside of an Arduino right from the beginning.
It's reasonable to do it with an Arduino.
And you always have to keep in mind that the Due runs on 3V3 and not 5V.
...and that could be problematic when working with PS/2 (TrackPoint), which runs with 5V.
A possibly naive idea: Cycle through the rows and columns real fast, applying a voltage to them.
If you always keep it in mind, it's not such a big problem. You just have to make sure you use some kind of voltage divider if a PS/2 output goes to a Due input.
Almost the right idea: cycle through the columns and make the row pins inputs. If you read any input for a given column, you have a key hit.
But you have to derive which pins are which column or which row. That may be quite a lengthy task.
Does it really become that more complex?
Then I would check if a current is flowing.
Disadvantage: Setting the pins via a shift register may take some extra clock cycles, thus slowing down scan speed.
For comparison: The KeyWarrior is clocked at 6MHz.
QuoteThen I would check if a current is flowing.How do you do that?
If you can hit a key 5 times a second you're really fast, even with the shift registers you'll get a scan rate much above 5Hz.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16