Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
DC motor for torque
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  20 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Joe Ibershoff  
View profile  
 More options Jul 13 2012, 11:43 pm
From: Joe Ibershoff <j...@ibershoff.com>
Date: Fri, 13 Jul 2012 20:43:24 -0700 (PDT)
Local: Fri, Jul 13 2012 11:43 pm
Subject: DC motor for torque

Hey folks,

I've been lurking on the listserv for a while, heard about this group at
Code PalPOUsa last March.  I'm a software engineer by trade, but kind of a
newb at hardware stuff.  I've got a project I'm working on right now where
I want to turn this rotary switch<http://www.digikey.com/product-detail/en/C7D0224N-C/451-1038-ND/514092> (datasheet
here <http://www.electro-nc.com/rotaryus/c7.pdf>) at something like 60 to
120 rpms while I'm pressing a button.  I only need to run this for short
bursts, not for hours on end.  I'm somewhat limited in space and weight
(and cost), and that will need to include the power supply -- which means
I'm probably restricted to DC motors only.  The real kicker is that this
switch requires about 25 in-lbs of torque to overcome the resistance of its
detents.

Anyone have any suggestions?  I need to wrap this project up by Labor Day
weekend, so I can't afford much lead time on ordering parts.  Bonus points
if your suggestion is easily attached to this switch's flatted shaft
(dimensions given in the datasheet).

Thanks,
 -- Joe Ibershoff


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "{LVL1} DC motor for torque" by Sean McPherson
Sean McPherson  
View profile  
 More options Jul 14 2012, 12:03 am
From: Sean McPherson <sean...@gmail.com>
Date: Sat, 14 Jul 2012 00:03:51 -0400
Local: Sat, Jul 14 2012 12:03 am
Subject: Re: {LVL1} DC motor for torque

Cordless drill? Would chuck right onto the shaft or could with easy
machined bit. Plenty of torque, built in battery, settable speeds, etc.
Dremel would work, too, prolly, even smaller.

Sean


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joe Ibershoff  
View profile  
 More options Jul 14 2012, 6:29 am
From: Joe Ibershoff <j...@ibershoff.com>
Date: Sat, 14 Jul 2012 03:29:12 -0700 (PDT)
Local: Sat, Jul 14 2012 6:29 am
Subject: Re: {LVL1} DC motor for torque

Sean, that's a beautiful suggestion!  A drill would almost certainly be too
large for this project, but perhaps a cordless screwdriver would work.
 I've got approximately 8" x 5" x 5" total to work with, and there are some
other components taking up space as well -- I guess it would have made
sense for me to figure that out and put the dimensions in the original
question, huh?  Leaving additional room for the switch itself to attach to
the end of my "motor", I think the device would need to fit within 6" x 3"
x 3" in the worst case, but smaller would give me more flexibility in
putting the rest together.

Whatever rotary device I go with, I'll probably need to open it up anyway
so I can connect the button (which has to be external to the box) to it, so
while I'm at it I can remove a little casing and/or move the battery or
other components around to help make it fit, if needed -- I'm not
necessarily limited by the advertised dimensions.  ;-)  I'm probably going
to have to get a soldering iron before I go much farther in this project,
heh.

Thanks Sean!
 -- Joe


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
#  
View profile  
 More options Jul 14 2012, 7:30 am
From: "#" <jasonpittman...@gmail.com>
Date: Sat, 14 Jul 2012 06:30:21 -0500
Local: Sat, Jul 14 2012 7:30 am
Subject: Re: {LVL1} DC motor for torque

junkyard a power window motor or power antenna motor 12vdc   ,

 Darlington transistor an a arduino to control speed with a push button
http://www.digplanet.com/wiki/Darlington_transistor


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joe Ibershoff  
View profile  
 More options Jul 16 2012, 8:09 am
From: Joe Ibershoff <j...@ibershoff.com>
Date: Mon, 16 Jul 2012 05:09:08 -0700 (PDT)
Local: Mon, Jul 16 2012 8:09 am
Subject: Re: {LVL1} DC motor for torque

Sean, I shouldn't have doubted you -- I found an old cordless drill I
haven't used in years and decided to take it apart to see if it could fit
after all -- sure enough, the internal components will just make it.
 Unfortunately it doesn't have a check, just a hex socket, so I may have to
ruin the drill with some gorilla glue to make it grab the switch's shaft.


Thanks again!

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brad Luyster  
View profile  
 More options Jul 16 2012, 8:23 am
From: Brad Luyster <bradluys...@gmail.com>
Date: Mon, 16 Jul 2012 08:23:51 -0400
Local: Mon, Jul 16 2012 8:23 am
Subject: Re: {LVL1} DC motor for torque

Just a heads up: At that speed, you're going to wear out the contacts on
that switch pretty quickly.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Hibben  
View profile  
 More options Jul 16 2012, 8:42 am
From: Ben Hibben <the.blens...@gmail.com>
Date: Mon, 16 Jul 2012 08:42:05 -0400
Local: Mon, Jul 16 2012 8:42 am
Subject: Re: {LVL1} DC motor for torque

Also: rather than glue something find a cheap (non-hardened) allen wrench
that fits your hex socket and then round one side of it for the drill using
our metal lathe.  I'll help if you like.  Go slow and don't try to take too
much off at a time; patience will help save the part, your sanity, and the
lathe.

Blenster

PS: if it is a hardened allen wrench just use sandpaper.  It's cheap, easy,
and won't hurt the lathe and will eventually do the same thing; just slower
due to the hardening.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pat McCarthy  
View profile  
 More options Jul 16 2012, 9:57 am
From: Pat McCarthy <pmccar...@humana.com>
Date: Mon, 16 Jul 2012 13:57:41 +0000
Local: Mon, Jul 16 2012 9:57 am
Subject: RE: {LVL1} DC motor for torque

Not sure if this applies but if you are working with a cordless drill motor, and have removed the chuck, the shaft you are left with has an unusual property... the inner thread on the shaft (Used to attach the chuck)is reverse threaded... just an fyi from my battlebot days... (I used a ton of DeWalt Hammerdrill motors... still boxes of the motor/planetary gear components in the basement

From: lvl1@googlegroups.com [mailto:lvl1@googlegroups.com] On Behalf Of Ben Hibben
Sent: Monday, July 16, 2012 8:42 AM
To: lvl1@googlegroups.com
Subject: Re: {LVL1} DC motor for torque

Also: rather than glue something find a cheap (non-hardened) allen wrench that fits your hex socket and then round one side of it for the drill using our metal lathe.  I'll help if you like.  Go slow and don't try to take too much off at a time; patience will help save the part, your sanity, and the lathe.

Blenster

PS: if it is a hardened allen wrench just use sandpaper.  It's cheap, easy, and won't hurt the lathe and will eventually do the same thing; just slower due to the hardening.
On Mon, Jul 16, 2012 at 8:23 AM, Brad Luyster <bradluys...@gmail.com<mailto:bradluys...@gmail.com>> wrote:
Just a heads up: At that speed, you're going to wear out the contacts on that switch pretty quickly.

On Mon, Jul 16, 2012 at 8:09 AM, Joe Ibershoff <j...@ibershoff.com<mailto:j...@ibershoff.com>> wrote:

Sean, I shouldn't have doubted you -- I found an old cordless drill I haven't used in years and decided to take it apart to see if it could fit after all -- sure enough, the internal components will just make it.  Unfortunately it doesn't have a check, just a hex socket, so I may have to ruin the drill with some gorilla glue to make it grab the switch's shaft.

Thanks again!

The information transmitted is intended only for the person or entity to which it is addressed
and may contain CONFIDENTIAL material. If you receive this material/information in error,
please contact the sender and delete or destroy the material/information.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joe Ibershoff  
View profile  
 More options Jul 17 2012, 3:56 pm
From: Joe Ibershoff <j...@ibershoff.com>
Date: Tue, 17 Jul 2012 12:56:14 -0700 (PDT)
Local: Tues, Jul 17 2012 3:56 pm
Subject: Re: {LVL1} DC motor for torque

That's for all the suggestions folks -- I really appreciate it.

The note about wearing out the contacts is pretty key.  Now I'm rethinking
how I want to approach this.  I've hit a lot of different little obstacles
over the last few weeks that have made me alter my design, and I haven't
sat down to really think about the big picture in a while...  Now I'm
thinking perhaps I should use an arduino and some relays rather than the
rotary switch.  It would be smaller and lighter parts, and presumably a
more durable result.  (Or maybe that's a bad assumption...  Would I wear
out the relay putting it through a lot of on/off cycles?)   There was a
reason I originally didn't want to go that route, but I think my current
idea doesn't have that limitation.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brad Luyster  
View profile  
 More options Jul 17 2012, 4:03 pm
From: Brad Luyster <bradluys...@gmail.com>
Date: Tue, 17 Jul 2012 16:03:11 -0400
Local: Tues, Jul 17 2012 4:03 pm
Subject: Re: {LVL1} DC motor for torque

Joe,

The relay would be a better option, but a lot of relays will suck down
power at a pretty hungry rate (more than an arduino can provide, but not as
much as a drill motor!).  Relays are usually rated in the tens-of-thousands
of cycles arena.

Maybe you could describe what you're trying to do in a little more detail,
and more suggestions will crawl out of the woodwork.

-Brad


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sean McPherson  
View profile  
 More options Jul 17 2012, 4:06 pm
From: Sean McPherson <sean...@gmail.com>
Date: Tue, 17 Jul 2012 16:06:59 -0400
Local: Tues, Jul 17 2012 4:06 pm
Subject: Re: {LVL1} DC motor for torque

I don't want to sound like I'm being snoopy, but if you don't mind my
asking, what the heck are you trying to *do* at the end of the day? :)
Given a better picture of goal (ie, "I have 25 different circuits that need
to be turned on and off at a rate of 60 to 120Hz, and each circuit will
carry 12VDC @ 200 mA, and the expected duration of the total runtime is 5
minutes with a 30 minute cooldown cycle. I have a budget of $500 for my
prototype and I want to eventually get a design in place where I can
produce 10,000 units for ~$50 each") I bet we can provide some alternate
ideas that'll help meet the needs. In a lot of cases of high-spped
switching, for example, it may mean using SCRs to control flow electrically
rather than mechanically, which removes the isues of duty cycles to a
greater extent and can provide much faster response times. But since I
don't know the situation, I can't make any realrecommendations (and trust
me, I'm one of the LEAST competent folks on the list to make suggestions; I
just ride a broom most days).

Sean


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
#  
View profile  
 More options Jul 17 2012, 4:08 pm
From: "#" <jasonpittman...@gmail.com>
Date: Tue, 17 Jul 2012 15:08:34 -0500
Local: Tues, Jul 17 2012 4:08 pm
Subject: Re: {LVL1} DC motor for torque

first off , what is this switch controlling ?    a dial of some sort ?
   your trying to turn this "dial"  that controls somthen else ?  what is
it ?

you could delete the  "dial" all together !     not needing  a motor to
turn it .      and controls  via  pulse width modulation an a triac an not
need a relay either ,

  before i could type this post others are asking you the same question ,
heh  :)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joe Ibershoff  
View profile  
 More options Jul 18 2012, 10:54 am
From: Joe Ibershoff <j...@ibershoff.com>
Date: Wed, 18 Jul 2012 07:54:15 -0700 (PDT)
Local: Wed, Jul 18 2012 10:54 am
Subject: Re: {LVL1} DC motor for torque

Nah, you guys aren't being nosey, and I really do appreciate the
suggestions you're giving.  I usually try to censor myself because I tend
to give too much unnecessary detail.  But, you asked for it, so here goes:

   - I have 5 identical components that require 4.8V power supply.  I'm not
   sure of the amperage they pull, but each was originally powered by a 4-cell
   pack of 250mAh NiMH batteries.  I guess if I knew how long it can run
   without a recharge, I could estimate the amps...  but you're not supposed
   to run this component continuously, so it would be a pain to do that.  The
   original wires are pretty thin, they feel like standard 24AWG to me, not
   sure if that says anything.
   - I need to be able to turn these components on in various combinations.
    Sometimes they will be on individually, sometimes in pairs, and sometimes
   in triples.
   - For the sake of clear terminology, I'll label these components A
      through E.  I'll call each combination of components a "mode", and will
      label it by the components which are on at the time -- so A, B+D, and C+D+E
      are all modes.  There are 25 modes I will be using; 5 single-component, 10
      double-component, and 10 triple-component.
   - The finished device will be active for short bursts, likely no more
   than 5 seconds at a time (probably 2 to 3 seconds).  Sometimes the rest
   period could be as short as 5 to 10 seconds, other times it could easily be
   30 minutes to an hour or longer.  All said and done, I expect the device
   will be active for a total of no more than 30 to 45 minutes per day.
   - When the device is active, it will need to switch between modes
   frequently -- this is something I'll want to experiment with and tweak once
   I see the device in action, and is something that could yield to the
   limitations of my components to a certain extent.  For now let's say the
   mode will change on the order of 30 times per second, possibly at irregular
   intervals down to a granularity of 1/60th of a second.
   - Budget...  eh, I don't have a fixed budget, it's just that this is all
   coming out of my own pocket.  ;-)  I don't mind dropping some cash if it's
   going to make a big difference in the result, but if I can help it I'd like
   to keep this part of the project to $100 or less.
   - I'm not concerned with production costs.  This is probably a one-time
   deal, and if I ever make another it will be another individual device, not
   part of a production run.
   - Longevity isn't too big a deal either -- if it can handle a week of
   that sort of punishment without replacing anything except batteries, I'd be
   happy as a clam.  On the other hand, I would like to be sure that any parts
   which are likely to wear out in that timeframe can be easily replaced.
    (That's why I got gun-shy about the rotary switch wearing out, since
   attaching it to the drill motor was not going to be trivial.)

Right now, I'm looking at using an Arduino Mega 2560(http://arduino.cc/it/Main/ArduinoBoardMega2560 probably
overkill for this, but I might use it for other things too) with 5 relays
controlling power to the 4.8V components.  I'd probably hook up an 8-pack
of AA batteries to give 12V power to the arduino, which for convenience I
would leave powered up a lot of the time, even when the device itself isn't
active... but probably no more than 2 hours total in the day.

I'm looking at these relays
(http://www.digikey.com/scripts/DkSearch/dksus.dll?keywords=PCN-105D3M...)
 because:

   - The coil operates at 5VDC, so it should run directly off I/O pins from
   the mega2560
   - The coil pulls 24mA, and the specs for the mega2560 say I can pull up
   to 40mA through each 5V I/O pin
   - The contacts can handle a load of 3A.

The only question mark is the 3A contact load -- I don't know how much my
components are pulling.  An alternative relay would be this one
(http://www.digikey.com/product-detail/en/G5CA-1A-E%20DC5/Z2161-ND/699...

   - The coil operates at 5VDC
   - The coil would pull the full 40mA from the I/O pin
   - The contacts have a rated load of 10A at 30VDC, and a max current of
   15A -- I think that means it could handle 15A at the 4.8V I'll be running
   through it.

Of course, these relays are more expensive and take up more space, so
combined with the 40mA pull I'd rather get the others if they'll work for
me.

So that's where I am -- any other thoughts, cautions, or suggestions?  Does
anyone have an ammeter I could use to figure out what load I need to handle?

Thanks,
 -- Joe


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
#  
View profile  
 More options Jul 18 2012, 11:47 am
From: "#" <jasonpittman...@gmail.com>
Date: Wed, 18 Jul 2012 10:47:19 -0500
Local: Wed, Jul 18 2012 11:47 am
Subject: Re: {LVL1} DC motor for torque

this could be done couple ways i can think of ,

 heres code example  of one ways using relays ,   ill see if i can dig up
some more schematics an code for some of the other ways to do this

    one of the guys in LVL1 made a christmas light controller
http://www.solsticewerks.com /   its pretty close to what your trying to do
..     maybe he will chime in :)

[image: Inline image 1]

// constants won’t change. They’re used here to
// set pin numbers:
const int buttonPin = 2; // the number of the pushbutton pin
const int RelayPin = 3; // the number of the Relay pin

// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
int relayState = 0; // relay is off at start

void setup() {
// initialize the Relay pin as an output:
pinMode(RelayPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);

}

void loop(){
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);

// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// change relay state
// see if relay is on or off:
if (relayState == HIGH) {
digitalWrite(RelayPin, HIGH);
relayState = 0;
// if relay is on, turn it off
// counterintuitive, but HIGH turns relay off

}

else {
digitalWrite(RelayPin, LOW);
relayState = 1;
// if relay is off, turn it on
// counterintuitive, but LOW turns relay on
}

delay(250);
// debounce

  hb_relay5.jpg
58K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bill Piepmeyer  
View profile  
 More options Jul 18 2012, 2:05 pm
From: Bill Piepmeyer <bi...@solsticeinc.net>
Date: Wed, 18 Jul 2012 14:05:35 -0400
Local: Wed, Jul 18 2012 2:05 pm
Subject: Re: {LVL1} DC motor for torque
I will be happy to chime in. The light controller is probably overkill
for what you want to accomplish, mostly because it is all geared toward
switching A/C. But there are a lot of options to do this. The circuilt
below from "#" would work well.  You could also order
a multi-channel relay board

This one you would need to order 2 but they are dirt cheap and I have
bought many things from this seller and I have always been happy with my
purchase and speed of shipment.

http://www.ebay.com/itm/4-Channel-12V-Relay-Module-For-Arduino-PIC-AR...

This one from the same seller is an 8-channel

http://www.ebay.com/itm/8-Channel-Relay-Interface-Board-Module-DC-5V-...

You can bid on this one, these usually can be had at the starting bid
price as not too many people bid on these things and they are listed for
auction very regularly.

Here is a 4 channel going soon
http://www.ebay.com/itm/4-Channel-Relay-Board-Module-Four-Channels-fo...

You get the idea, there are lots to be found. These will interface
directly with an Arduino or similar such as the Teensy. We have Teensy's
available in the store too. You will just need to add something like a
12v wall-wart power supply to power the relay board.

There are several ways to accomplish the sequencing. You can simply
program the microcontroller directly to sequence or you can use
something like I used for the Christmas Light controller.  It uses a
program called Vixen which allows you to setup a sequence of steps to
turn things on or off for a specified duration graphically. This makes
adjust the sequence and combinations trivial. You can use a Teensy in
Arduino mode (Teensyduino) and simply download the source code and/or
firmware to allow it to talk with Vixen over a USB cable and you are done.

BOM:  Teensy   $15
             Relay Board  $20
             Power Supply $5  (or use an old PC power supply)
             Misc hardware and wire $2
Total cost  $42

Estimated Time to go from nothing to testing 3-4 hrs

This same setup works if you want to be standalone and have the Teensy
or Arduino do all of the sequencing and not have a PC connected then you
will just need to make sure you have power for the microcontroller
(Arduino, Teensy, whatever). If you use the Teensy an standard cell
phone charge with a mini-usb connector works great. I use my iphone
charger regularly to do this.

Hope this helps,

Bill


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
DE 'Tad' Heckaman III  
View profile  
 More options Jul 18 2012, 2:07 pm
From: "DE 'Tad' Heckaman III" <dougl...@gmail.com>
Date: Wed, 18 Jul 2012 14:07:46 -0400
Local: Wed, Jul 18 2012 2:07 pm
Subject: Re: {LVL1} DC motor for torque

If eBay isn't your thing, I've also purchased similar boards from Amazon:
http://www.amazon.com/SainSmart-4-Channel-Relay-Module-Arduino/dp/B00...

On Wed, Jul 18, 2012 at 2:05 PM, Bill Piepmeyer <bi...@solsticeinc.net>wrote:

--
Tad Heckaman

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
#  
View profile  
 More options Jul 18 2012, 2:19 pm
From: "#" <jasonpittman...@gmail.com>
Date: Wed, 18 Jul 2012 13:19:56 -0500
Local: Wed, Jul 18 2012 2:19 pm
Subject: Re: {LVL1} DC motor for torque

i use Darlington_transistors alot to control relays , reason mainly is its
cheaper an less soldering an if your controlling more then one relay at a
time it saves space ...  just easier to me

J2 would connect to pins on your arduino you define in the code ,      im
looking for a good code example

[image: Inline image 1]

On Wed, Jul 18, 2012 at 1:07 PM, DE 'Tad' Heckaman III
<dougl...@gmail.com>wrote:

  8_relay_sch.jpg
48K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
#  
View profile  
 More options Jul 18 2012, 2:22 pm
From: "#" <jasonpittman...@gmail.com>
Date: Wed, 18 Jul 2012 13:22:11 -0500
Local: Wed, Jul 18 2012 2:22 pm
Subject: Re: {LVL1} DC motor for torque

 *where it says +12 volts an its connected to the J2 ,, that will blow your
arduino ,   ill edit it

  8_relay_sch.jpg
48K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
#  
View profile  
 More options Jul 18 2012, 3:16 pm
From: "#" <jasonpittman...@gmail.com>
Date: Wed, 18 Jul 2012 14:16:26 -0500
Local: Wed, Jul 18 2012 3:16 pm
Subject: Re: {LVL1} DC motor for torque

this is basically a digital on/off switch if your wanting  presets  for
instance "  push button X and relay # 1,2 and 4 activate on/off then code
needs editing ,

Darlington_transistor connected to pins defined in code ,     tactile
pushbuttons on pins defined in code

[image: Inline image 1]

[image: Inline image 2]

#include <Bounce.h>    // http://www.arduino.cc/playground/Code/Bounce
#include "SeeeduinoRelay.h"

// Pin definitions for four buttons connected to the Arduino for testing.

#define Button1pin 8
#define Button2pin 9
#define Button3pin 10
#define Button4pin 11

// Define "bounce" objects for input buttons.
// Bounce is really nice, you should use it.
// http://www.arduino.cc/playground/Code/Bounce
Bounce Button1 = Bounce(Button1pin, 5);
Bounce Button2 = Bounce(Button2pin, 5);
Bounce Button3 = Bounce(Button3pin, 5);
Bounce Button4 = Bounce(Button4pin, 5);

SeeeduinoRelay RELAY1 = SeeeduinoRelay(1,LOW);
SeeeduinoRelay RELAY2 = SeeeduinoRelay(2,LOW);
SeeeduinoRelay RELAY3 = SeeeduinoRelay(3,LOW);
SeeeduinoRelay RELAY4 = SeeeduinoRelay(4,LOW);

void setup()
{
  // Setup input pins
  pinMode(Button1pin, INPUT);
  digitalWrite(Button1pin, HIGH);  // Activate internal pullup
  pinMode(Button2pin, INPUT);
  digitalWrite(Button2pin, HIGH);  // Activate internal pullup
  pinMode(Button3pin, INPUT);
  digitalWrite(Button3pin, HIGH);  // Activate internal pullup
  pinMode(Button4pin, INPUT);
  digitalWrite(Button4pin, HIGH);  // Activate internal pullup

  Serial.begin(9600);
  Serial.println("Ready");

}

// This is the demo loop.   Check state of each button, toggle relay
// and print out status of relays.
void loop()
{

  if (Button1.update() )
  {
    if (Button1.read() == LOW)
    {
      Serial.print("Button #1 pressed: ");
      Serial.print("Relay #1 state was ");
      Serial.print(RELAY1.state());
      RELAY1.toggle();
      Serial.print(", now relay is ");
      Serial.println(RELAY1.state());
      if (RELAY1.isRelayOn()) Serial.println("Relay #1 is on");
      if (RELAY1.isRelayOff()) Serial.println("Relay #1 is off");
    }
  }

  if (Button2.update() )
  {
    if (Button2.read() == LOW)
    {
      Serial.print("Button #2 pressed: ");
      Serial.print("Relay #2 state was ");
      Serial.print(RELAY2.state());
      RELAY2.toggle();
      Serial.print(", now relay is ");
      Serial.println(RELAY2.state());
      if (RELAY2.isRelayOn()) Serial.println("Relay #2 is on");
      if (RELAY2.isRelayOff()) Serial.println("Relay #2 is off");
    }
  }

  if (Button3.update() )
  {
    if (Button3.read() == LOW)
    {
      Serial.print("Button #3 pressed: ");
      Serial.print("Relay #3 state was ");
      Serial.print(RELAY3.state());
      RELAY3.toggle();
      Serial.print(", now relay is ");
      Serial.println(RELAY3.state());
      if (RELAY3.isRelayOn()) Serial.println("Relay #3 is on");
      if (RELAY3.isRelayOff()) Serial.println("Relay #3 is off");
    }
  }

  if (Button4.update() )
  {
    if (Button4.read() == LOW)
    {
      Serial.print("Button #4 pressed: ");
      Serial.print("Relay #4 state was ");
      Serial.print(RELAY4.state());
      RELAY4.toggle();
      Serial.print(", now relay is ");
      Serial.println(RELAY4.state());
      if (RELAY4.isRelayOn()) Serial.println("Relay #4 is on");
      if (RELAY4.isRelayOff()) Serial.println("Relay #4 is off");
    }
  }

  8_relay_sch.jpg
52K Download

  7relays_BreadBord_small.jpg
203K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
#  
View profile  
 More options Jul 18 2012, 3:19 pm
From: "#" <jasonpittman...@gmail.com>
Date: Wed, 18 Jul 2012 14:19:11 -0500
Local: Wed, Jul 18 2012 3:19 pm
Subject: Re: {LVL1} DC motor for torque

http://husks.wordpress.com/2011/07/14/a-too-simple-arduino-library-fo...

  8_relay_sch.jpg
52K Download

  7relays_BreadBord_small.jpg
203K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »