How tu controll 5 rumble motors via usb or i2c bus?


rohezal

Advanced Member
Joined
Oct 18, 2009
Messages
1,712
Hi,

I am writing my master thesis in computer science next month, and one thing I need for it, is a glove with 5 fingers. If one fingers touches a virtual object the motor in this finger should start to rumble. I would like to use one of these:

https://www.ibr.cs.tu-bs.de/projects/inga/index.xml?lang=en

Are there motors which can be startet / stopped direcly via usb or i2c?

Kind regards

rohezal
 
Well I know adafruit has a lot of kits that can handle this type of thing.. There is no motor that can be driven directly by i2c, but a controller board can be used...  Which this may work: http://www.adafruit.com/products/1411#Description , it's actually using a chip that was designed to drive LEDs with I2C, but they added some surface mount fets that can drive small motors that run at 6Vs.. there are other i2c interface boards that may be better since I just did a quick search.

Edit: you could add relays or higher rated fets to the circuitry if you need to drive more that what that adafruit board is designed to do..

Edit2: So that thing isn't rated to drive motors directly, you would need to wire in relays, fets or something to deal with the higher current.. , This is another pre-built solution, but it can only run 4 regular DC motors at once.. But you can stack these to add more channels.. a bit pricey though... http://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino
 
Last edited by a moderator:
Use a darlington array and your preferred microcontroller with either USB or i2c as you see fit. I'm a big fan of the pic18f4550. It's cheap and easy to use.
 
Ah i didn't know something like darlington arrays existed.. they're in a nice dip package with protection diodes.. Although last time I had to make a stepping motor controller from scratch all I had was discrete components to work with.

Well pics are good, but he's looking for an I2C interface, also wasn't sure what level his electronics skills are so I pointed out some easy entry solutions.

Edit: AH that PIC does have I2C abilities..
 
Last edited by a moderator:
AH that PIC does have I2C abilities..
And USB. And 36 GPIO on the dip package. And an internal 48Mhz oscillator. All you need is a breadboard, 3-5v power supply, and some wire. That's why it's my favourite, it just does everything in a cheap little package.
 
Yeah don't bother trying to bitbang i2c, as darned near any super cheap easy to use chip has it already. Driving some motors is not too hard, especially if they are low amperage -- ie: if you're driving _wheels_ on a robot or car, it can be tricky (look up 'H bridge' and the amperage ramifications.. notably, the jam-current or reverseal-current), but if you're just trying to spin up some steppers or servos or little motors you can likely get away with simple GPIO .. or toss a little motor controller board (you can get low amperage ones for $15 I think).

So pick a microcontroller of choice (avr or PIC being the popular ones, or even an arduino if you want ready-to-use library code). Really not too hard to do, once you get over the hump :)

I'm more a fan of avr than pic, myself :)

jeff
 
Well this conversation got me interested in finishing my ADC project. I was going to use a RPi, but it's way overkill for what I plan on using it for. Time is still my enemy.
 
Thank you for your advises, I will have a closer look at the PIC :) .

Edit:
 

Sorry I am electric noob, just soldered an i2c infrared sensor and 2 capacitors on a micro controller board. Is the darlington array a chip which powers the motors, build in in the pic? So I can just write:

#define power_on 1

#define power_off 0

i2c_write(device_id, memory_address_of_power_port1, power_on);  //memory_address_of_power_port1 = motor1

on my main micro controller board? Or do I have to do different stuff?
 
Last edited by a moderator:
Quick lesson: A transistor is a switch: apply power to the middle pin of the transistor and it allows power to flow through the transistor. Many uses, but in this case, by connecting the first pin of the transistor directly to the battery, it allows you to turn on a higher voltage/amp device with a low voltage/amp microcontroller. A darlington array takes it a step further, it is a package of transistors and diodes that allows you to connect a high amp device (like a motor) safely to your electronics.

You can just connect the output of the microcontroller to your device, and this usually works well for a few LEDs, but a motor would almost definitely burn out your microcontroller, or at least cause a power draw so large that it resets every time you turn it on. By using the darlington array, you can power the motor safely.

As far as the microcontroller is concerned it's exactly the same, you'd still set the output pin to high to turn something on, the only difference is that pin would now go into one of the input pins on the array chip and the motor would be connected to the appropriate output pin.

For REALLY high volt/amp devices (like a big motor, or incandescent lamp) you'd need a relay, but those are big and bulky and not something to worry about here.

For your microcontroller code, it would have to check the i2c registers periodically to see what has changed, and then turn on the appropriate output. About 10 lines of C code on the pic18f4550 to set everything up.
 
You may want to look into gooling 'arduino' + topic of interest, since the arduino is very popular and that will get you schematics and tutorials aplenty; you can use the electronics advice without uwing an arduino. If you don't want to write the code yourself, just get into arduino .. writing an i2c master or slave can be tricky depending on the microcontroller used, but with arduino you get a ready to use library. (I don't use arduino at all myself, I like to get right to the metal, but arduino does get you up and going fast.. and sounds like time is not on your side ;)

jeff
 
AH that PIC [PIC18f4550] does have I2C abilities..
And USB. And 36 GPIO on the dip package. And an internal 48Mhz oscillator. All you need is a breadboard, 3-5v power supply, and some wire. That's why it's my favourite, it just does everything in a cheap little package.
Did you ever have USB working with that setup? I'm pretty sure that the USB requires a crystal and 4 external capacitors; and you need to be pretty lucky to get it working on breadboard.
 
I would agree about using Arduino if you don't have experience with this sort of thing and want to get it going quickly. It comes with ready-to-use USB, configured as a virtual serial port. (The Arduino Leonardo and its relatives allow for the possibility of using other USB configurations - this is more involved than the default method, but probably still easier than PIC.)
 
Back
Top