Help a newbie with a (simpler?) Arduino project

Ideas and instructions how you can make your own bondage toys.
Post Reply
quinto
*
Posts: 1
Joined: 04 Feb 2015, 11:06

Help a newbie with a (simpler?) Arduino project

Post by quinto »

I'm interested in creating an arduino program, but I don't know much about electronics. I've read through this forum:
http://forum.boundanna.net/board/viewto ... =12&t=8478

But it is a bit too difficult for me to understand. It also has a lot of features that I'm not looking for. Instead, I want to learn by starting with an easier project. I have three california exotics egg vibrators that I'd like to hook up to an arduino. Each egg vibrator takes 2 AA batteries ( 3V total, 1.5V each for standard AA battery). With a tech sheet, I'm guessing each egg requires 3V.

I do have a few questions if someone doesn't mind answering:

(1) Can I run them all at once on the arduino by hooking the wires directly to the pins? The thread I linked talked about MOSFETs, but I don't think I need them? The arduino wiki says:
If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW.
So that means I can power each bullet so long as I put a resistor between the eggs and the 5V pins?

(2) The vibrators are similar to this:
http://www.vitacost.com/Images/Products ... 004024.jpg

You can't see it very well, but there are two wires running in parallel back to the controller. Is one wire GROUND and the other power (I would hook this up to the arduino pin)?

(3) digitalWrite() seems to output a fixed number of volts. Is there a way I can vary the voltage to get speeds between HIGH - LOW vibrator speeds? I'm assuming that varying voltage is what causes the rotors to vary in speed. I'm fine with hardcoding the patterns into the program. Something like:

start - speed at 3V
10s - speed at 1V
20s - speed at 2.5V
repeat

- To power everything, can I choose a battery that has a really high mAh to get hours of running? I found this which has 6Ah, but only at 3.7V:
https://www.sparkfun.com/products/8484

I was thinking of using the Arduino Mini Pro to keep things small (aside from the battery) and maybe the Uno as a test board. How long will that battery last with this configuration? Will I need two?

Thanks all!
User avatar
Sir Cumference
Moderator
Posts: 1608
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Help a newbie with a (simpler?) Arduino project

Post by Sir Cumference »

Welcome aboard.

(1)
An Arduino is a controller. If you draw more than 40 mA from a pin, you are likely to ruin it.
40 mA is enough to run light emitting diodes (LED), trigger small relays and control transistors, but not more than that.
Connect your motor directly, and you are very likely to ruin your Arduino.

If you limit the current to 30 mA (nominally 167 ohms, 180 or 220 would be fine) your arduino is safe.... but there is not enough current to actually make the motor turn.
That is why you need some sort of transistor to control the power to your motor.

(2)
Yes. Switch the polarity, and you will make it rotate the other way around. But in a vibrator, that will make no difference.

(3)
Yes.
digitalWrite(motorpin1,HIGH) will output 5V on the pin you have called motorpin1
digitalWrite(motorpin1,LOW) will output 0V on the pin you have called motorpin1

To regulate, you must use pulse width modulation (PWM, the pins marked with a ~ can do that). You give values from 0 to 255.
analogWrite(motorpin1,127) will output approximately 2,5V on the pin you have called motorpin1. If you feed 3 volt to your MOSFET, you will then get 1½V from it. Or 10 V if you feed it 20V.
PWM does not really turn the voltage up and down. it just switches on and off really fast. If it is only on half of the time, an LED or a motor will act just like it received half the voltage. If you on the other hand connect a loudspeaker to it, you will hear a 1 kHz tone. (a really easy way to make a "beep" by the way :D )
If you attach a transistor, it will open and close along with the PWM-signal. This lets you control high voltages and currents.
(If you attach a mechanical relay...... it will work really bad in every respect!)



How long your battery will last, will depend on, how much current you draw from them.
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
User avatar
Sir Cumference
Moderator
Posts: 1608
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Help a newbie with a (simpler?) Arduino project

Post by Sir Cumference »

quinto wrote: Something like:

start - speed at 3V
10s - speed at 1V
20s - speed at 2.5V
repeat
This should do it:
(I have not bothered to calculate exact PWM values. They depend on how much voltage you feed the MOSFET)

Code: Select all

/*
Hacking "Blink" to make it perform something:

start - speed at 3V
(You did not write for how long? 5s ?)
10s - speed at 1V
20s - speed at 2.5V
repeat

I assume you feed 3V to your MOSFET


 */
 
// Motor output on pin 5
// give it a name:
int motorpin1 = 5;

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(motorpin1, OUTPUT);     
}

// the loop routine runs over and over again forever:
void loop() {
  analogWrite(motorpin1, 255);   // turn the LED fully on, digitalWrite(motorpin1, HIGH) would do the same
  delay(5000);               // wait for 5000 milliseconds
  analogWrite(motorpin1, 0);    // turn the LED off by making the voltage LOW, digitalWrite(motorpin1, LOW) would do the same
  delay(1000);               // wait for a second.... if you want a short break before the next level
  
  analogWrite(motorpin1, 160);   // turn the LED fully on, digitalWrite(motorpin1, HIGH) would do the same
  delay(10000);               // wait for 10000 milliseconds
  analogWrite(motorpin1, 0);    // turn the LED off by making the voltage LOW, digitalWrite(motorpin1, LOW) would do the same
  delay(1000);               // wait for a second.... if you want a short break before the next level
  
  analogWrite(motorpin1, 200);   // turn the LED fully on, digitalWrite(motorpin1, HIGH) would do the same
  delay(20000);               // wait for 20000 milliseconds
  analogWrite(motorpin1, 0);    // turn the LED off by making the voltage LOW, digitalWrite(motorpin1, LOW) would do the same
  delay(1000);               // wait for a second.... if you want a short break before the next level
}
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
User avatar
Sir Cumference
Moderator
Posts: 1608
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Help a newbie with a (simpler?) Arduino project

Post by Sir Cumference »

Do your developing on an Uno and a breadboard.
It is quick and easy.
Make it work with a resistor and an LED before attaching any MOSFETS and motors.

When everything is working (and you have run some tests), solder it together with a pro mini or similar.
But do not solder anything before you are satisfied!




The best thing to do, is to get an Arduino, a couple of LEDs, some 330, 1k and 10k resistors, and start playing.

Maybe also a couple of buttons, a 10k potentiometer, a couple of MOSFET breakout boards, some test leads and a "breadboard".
A cheap multimeter is a great help.

Follow some tutorials (Lady Ada's are great), and you will be doing it in no time.
It is not hard, but it can look quite frightening to begin with.
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
User avatar
AssTechWarrior
**
Posts: 113
Joined: 15 Jan 2015, 18:30

Re: Help a newbie with a (simpler?) Arduino project

Post by AssTechWarrior »

I have a lot of experience with embedded stuff and have used the Arduino many times.

Get the arduino IDE and walk through one of the tutorials on blinking lights to ensure your dev chain is sane.

Then, to power your external bits, lights, magnets, motors, zappers etc you will want an independant and ISOLATED power supply from your PC. A 12 volt motorcycle battery is a decent choice but use a fuse or breaker if you do, batteries can dump large currents in a short circuit.

My recomendation is to find an old laptop power suply that is rated at between 12 and 14 volts. The HP 40 watt chargers with the round pin are great, they prodive about 14.5 volts which is almost exactly the standard automotive bus voltage on the '12v' side. Check the voltage before you cut the round plug off the computer end but usually you will find one red wire and one black wire. These supplies are safe, short protected and very common in junk drawers. Add some type of connector or pins to that so it can be moved around.

Then buy an opto isolated relay board. fleabay is a good source, I have sevearl of these: http://www.ebay.com/itm/5V-9V-12V-24V-4 ... 566af6b913

They take a logic level input and use the 12v to power the relay coils and the loads protecting your PC and the arduino from spikes.

For motor control get one of these: http://www.ebay.com/itm/L298N-Dual-H-Br ... 2348dad979 For your 3v eggs use a a power supply that produces no more than 6 volts and is regulated. Even a good 5v 1 amp USB wall power plug may work but a PWM motor load is not what they are designed for. 4 duracells makes around 6 volts and work work well. You won't burn up the egg motors unless you run the PWM output at over 75% ( 0-255 range, 75% is 191 counts ) for long periods. Motors can handle higher voltages but only for shorter periods.

Then for input you can use just about anything. Neat suggestions are humidity sensors, temperature, position etc.

An IO shield for soldering can be nice for more durable projects: http://www.ebay.com/itm/UM-UNO-design-L ... 4ae340a66d

This type with a mini plugboard is easier for prototypes: http://www.ebay.com/itm/Arduino-UNO2011 ... 51cb64402c

Feel free to send me any other questions or post them here, I can certainly help, I have made lots of cool toys. :lol:
fetish4fun
*
Posts: 22
Joined: 27 Feb 2015, 22:56
Location: Canada

Re: Help a newbie with a (simpler?) Arduino project

Post by fetish4fun »

this stuff is over my level. i have a bullet with a head phone jack, i find it very interesting to feel my favourite song. but also extremity convenient and versatile it seems like a 3V as well. i hear relays mentioned, may i recommend rolling with the relays? why piddle with 3V when you can launch a rocket with 120V. shit you could run a full on fucking machine. 3 in fact if you felt so inclined.
User avatar
Sir Cumference
Moderator
Posts: 1608
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Help a newbie with a (simpler?) Arduino project

Post by Sir Cumference »

fetish4fun wrote:this stuff is over my level. i have a bullet with a head phone jack, i find it very interesting to feel my favourite song. but also extremity convenient and versatile it seems like a 3V as well. i hear relays mentioned, may i recommend rolling with the relays? why piddle with 3V when you can launch a rocket with 120V. shit you could run a full on fucking machine. 3 in fact if you felt so inclined.
Exactly what are you trying to say?
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
User avatar
Dark_Lizerd
*****
Posts: 2418
Joined: 22 Oct 2006, 11:30
Location: New Mexico

Re: Help a newbie with a (simpler?) Arduino project

Post by Dark_Lizerd »

... When in doubt...
... Super charge!!!

But, to keep this down and simple, which I think is what Quinto wanted...
Draw a picture showing everything a simple as possible...
Show the wires to cut, and where to connect them....
The program is already provided, now just the hardware...
All advice is checked, re-checked and verified to be questionable...
Don't ask, we both wont understand the answer...
http://www.mediafire.com/download/09dtr ... e_V2_2.exe Not just for nubies any more...
User avatar
Sir Cumference
Moderator
Posts: 1608
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Help a newbie with a (simpler?) Arduino project

Post by Sir Cumference »

Unfortunately, Quinto never logged in again....
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
Post Reply