Using Arduino Uno, USB Header Shield, and Motor Shield with USB Keyboard

Hi All,

I'm developing a project where I'd like to be able to use multiple arduinos hooked up to a keyboard able to take commands. I imagined the set up to go something like this:

5 servos, each attached to a different stack, each stack is an arduino uno, a usb shield, and a motor header, the USB shield is then connected to the keyboard.

Each servo is linked to a different keypress, so 'b' would turn one servo, 'n' would turn another, and so one, with corresponding keys for opposite direction.

Does this seem feasible? I've bought and am testing one stack at the moment but have been running into issues with the code as I am new to arduino, and haven't been able to fine many resources online.

Thanks in advance, please let me know if there are any questions.

bump!

5 elements each with a USB connector and how many keyboards?

Was hoping I could program them all to take commands from one keyboard, but could also change this to use a two button remote instead, so each finger has three servos which each has one dedicated 'stack'. I think I phrased that incorrectly above.

You only need to interface 1 keyboard, why the extra hardware?

There's Arduino Playground articles on using PS2 keyboards and mice with Arduino.
Walmart sells Logitech PS2 keyboard and mouse for $11.99.

One servo for each knuckle, three servos to a finger, each finger has one stack which has an arduino uno which requires a USB shield (for keyboard input) and a motor controller (one can controll all three servos). Where is the extra hardware?

5 USB Host shields and 1 keyboard.

I have my doubts that one USB keyboard can be shared between multiple devices. Do you have prove of the opposite?

That's was my concern, do you think it would be possible to hook up a simple electronic button pad that would feed to all of them or do you know of a way I can link multiple arduino's together to control each all together from one device or another way to accomplish this project?

rough93:
That's was my concern, do you think it would be possible to hook up a simple electronic button pad that would feed to all of them or do you know of a way I can link multiple arduino's together to control each all together from one device or another way to accomplish this project?

Yes.

I don't know how just much automation these chips can do but I think that you sell them short of possible.
OTOH I applaud your decision to spread the workload across controllers.

AVR's have ports for high speed SPI bus. A 16MHz Uno has default SPI xfer rate of 512KB/s. It can push an entire 512 byte block buffer through in under a millisecond.

You connect your controllers and other SPI devices to the SPI bus (you can use >1 bus too) and each has a select pin that the bus master turns ON and OFF to choose which one(s) hear(s) the bus and may reply. There is one bus master and 1+ bus slaves, and there are wiring variations like daisy-chaining that make SPI amazingly versatile. SPI needs 3 IO pins and for the master, 1 pin per slave select while slaves need 4 pins for the bus -- none of that counts power and ground, they are not IO pins!

How many pins per knuckle do you need? Are feedback sensors involved?

If I put a 328P (Uno/Nano/Mini chip) on the job with 4 pins taken for SPI and 2 for Serial, and ran on 8MHz internal clock to get 2 pins back, I'd have 16 pins left. That could run 15 servos faster than you'd see to do basic motions.

BTW, try moving just the last joint on ANY of your fingers. The last two are connected.

GoForSmoke:
Yes.

I don't know how just much automation these chips can do but I think that you sell them short of possible....
BTW, try moving just the last joint on ANY of your fingers. The last two are connected.

Wow, lots for me to research!

I must admit I'm new to the electronics game, having come from a generally more mechanical background, so I'll have to look up a lot of these acronyms and get a more raw understanding of what you're getting at, but I believe I see what you're suggesting, a mainline bus to connect/slave these controllers to before the keyboard/controller connection correct? Do you have an example of the bus?

I don't have feedback sensors planned as yet, but I was hoping at some stage to integrate into my code to have the motors controlled by muscle inputs from muscle sensors rather than keyboard strokes, or at least to modify the buttons so you could fit a button on either side of a human finger to move each mechanical finger independently.

This also brings me to clarify whether your explanation maintains that all fingers would be moved at once if you're slaving them all to a single bus, or if they're able to be each moved independently (finger or servo). Reading your explanation again, is this A) Where the master turns certain pins off or on to only trigger certain servos or B) Where multiple Buses would be needed as suggested. Would I then need to multiply my controllers to one per knuckle in order to control each knuckle independently?

Sorry if that's question overload, I'm getting pretty excited thinking about this and learning :slight_smile:
I appreciate your feedback!

Hi,
You are talking about fingers, knuckles and stacks.
What is the application?

How many servos?
How many motors?
How many servos do you think a single Arduino controller can control?

You then need to workout powersupplies, servos are somewhat power hungry, even when stationary.

Tom... :slight_smile:

SPI is Serial Peripheral Interface but when you look it up, SPI will do. It's fast and only selected devices read from or write to the bus.

Beyond that, I could spend hours typing what's already out there.

GoForSmoke:
SPI is Serial Peripheral Interface but when you look it up, SPI will do. It's fast and only selected devices read from or write to the bus.

Beyond that, I could spend hours typing what's already out there.
Gammon Forum : Electronics : Microprocessors : SPI - Serial Peripheral Interface - for Arduino

TomGeorge:
Hi,
You are talking about fingers, knuckles and stacks.
What is the application?

Tom... :slight_smile:

Application is a mechanical hand :slight_smile: should be able to complete basic motor tasks.

Sorry for the delay in reply, busy weeks and all that. Would this be simpler if I used a wifi/BT header on the stacks and could link them all to the Arduino IDE or a from scratch control program? I'd imagine it would and could save some time and effort too, would pay off to not have to be wired direct to the hand too.

Thanks

Simpler? What use of the word simpler is this? How do you plan to attach the radios? Buy boards with radios? Simpler but way more expensive.

Do you solder? I'm not much good at it and that limits what I can do but once in a while I solder anyway. I like to use DuPont Cables with female ends that slide snug onto header pins and sometimes make T's or put a chip in the middle, solder joins and heat shrink tubing to insulate are the way to go.

An alternative is to use telecom splices. A box of 50 runs about 25 cents each IIRC. Just be sure to get the right size range for your wires. With hair thin wires, splices are completely worth the money, most people can't solder those at all.

SPI is a bus. The 4 wires on the master go to every device on the bus and 1 wire goes from the master to each device you would have not listen or talk to the bus. They're not turned off, can run set tasks, just no bus comms.

Radios will be many times slower rate and radio messages can step on each other but that's what packet retries are for, right?

GoForSmoke:
Simpler? What use of the word simpler is this? How do you plan to attach the radios? Buy boards with radios? Simpler but way more expensive.

I can buy wifi/Ethernet headers for the arduinos instead of USB headers, which would simplify making it receive commands from a keyboard as I could use one program across all still but not have to connect a bus or 14 usbs to one hub.

I do have solder experience, are you talking about using the bus system with this technique?

I can understand the slowness of response, so I may try other methods to speed it up but for now, that would work in order to link all stacks with the IDE.

Thoughts?

rough93:
I do have solder experience, are you talking about using the bus system with this technique?

Yes, SPI bus. And with smart bus devices you can do without select pins through a bit of home-rolled protocol.
You would send messages prefaced by which device(s) should act on them, I'd use a simple ID number that each finger or joint would have a single bit identify it. That way you could give any set of ID's the same command (next part of the message) at the same time.

I have kicked an idea of a serial bus around where each chip's RX connects to the next chip's TX with last RX to first TX making a ring but I haven't worked that down to details. It would be slow to very slow compared to SPI but could be faster than human senses.

I'm also more practical/cost conscious about these things. Whatever the device costs to make, by the time it retails it will need to be worth at least 4x that. A lot of good ideas die commercially right there. But what you're doing is study, not end design, right? So you don't mind writing code for that and different for an end product?

PS - serial speeds.

Default SPI on a 16MHz Arduino xfers 512K bytes per second. Even 1/4 of that is 10x 115200 baud.
115200 baud serial xfers 11520 bytes per second.

The SPI messages should move quick and have more time not transmitting than the TTL serial.