Interactive Art Object Using Arduino+PIR sensors, hardware and code questions

Great, that's exactly the problem i had to solve, i have been surfing the web and found this website about controlling the motor.

I found out that i indeed need an dual H-bridge . this article could help me i think: it depends on the prices, and the current the H-bridge can supply whether i pick the H-bridge or two relays for each motor.
http://itp.nyu.edu/physcomp/Labs/DCMotorControl

All input is welcome, thanks so far.

doerack:
...
1x arduino, uno or Duemilanove (which do you guys recommend?)
5x whiper motor, car salvagejard
5x PIR sensor (http://www.samenkopen.net/action_product/927767/105314
5x solid state relays (link: Solid State Relay - 8A - COM-10636 - SparkFun Electronics)

Hi @Doerack,

First, I'm showing things from my own shop.. but that's the things I know best.

The list is good.

  • Either version of Arduino with 328 chip will be OK..

  • Wiper motors: do you know how much starting and running current they draw?? AND: What do you mean "2 directions?? Wiper motors rotate a crank inside and wipes move back and forth. If you reversed the motor the wipers would still move back and forth !!

  • PIR sensors are good. Here are some at about =$6 US: http://arduino-direct.com/sunshop/index.php?l=product_detail&p=173 These have 3 pins: +5V, Gnd, and a Digital output.

  • Relays or Drivers to run the Wiper motors: This is more of a possible problem. Need to know the current to be handled. (The Solid State Relays shown above are for AC power and will not work with the wiper motors)... You need either relays or Power Transistor drivers.

Here are relays: http://?.ws/YD-relay

Here are Power FETs which can be used to both switch and change the speed of DC motors like the wipers... :
http://arduino-direct.com/sunshop/index.php?l=product_detail&p=60

BUT: If you can get these things in Nederland without Customs that is probably better...

Your art installation sounds great... Make sure you post photos of it working!

Terry thanks for your input. i would like to say that i like the way how this forum treats newbies. In holland the forums are not always kind to you.

To provide u guys with more input:

Starting current: around 2 ah
running current they draw depends on the type, mine worked perfecty on a 7ah 12 battery, i will test tomorrow but i think 6 ah should be enough.

Here are some examples of other art projects (movies on youtube):

  • About the Wiper motors: you have different ones, 1 type rotes a krank inside, but some others don't , they can rotate back or forth by reversing the motor.

So how do those reversible ones work?
How are they wired?
What do you need to do to control them?
Do the have "limit switches" at the end of their movement??
Can you point to any online information about them?

Seems like they could be used for many things....

Window up/down motors are very useful also....

I'm trying to find the datasheet, but still no luck. it's an wiper motor from an hyundai exel (front window, the mechnics outside the motor created the back and forth motion)

i do know it operates between 12-13,8 volt, it uses max 7ah and starts up at 2 ah( but then with little torque).

The motor has 3 wires. 1= ground 2= gear 1 (slow), 3 = gear 2 (fast), two and three rotate in the same direction. I thought ik would turn foward and reverse, but that only works when i switch the wires. thy don't have an inbuilt limit switch. But that is not a problem, but at some time the motor has to stop turning. Maybe by creating some code, or else an limit switch.

Does an window motor also turn in one direction?

I'll explain my idea: The motors hang on the ceiling, each with a string attached with a little pointed steel weight. In startmode the strings hangs totally on the ground. When visitors of the artwork approaches, the sensor picks up the signal, the motor starts turning, the string and weight roll up into the sky. It's stops at the top (near the motor), when the visitor walks allong the motor rolls down the string and go back to it's starting point (just above the ground). This progress has to repeat itself over and over again for each motor seperately.

That's the concept! Now i just have to figure out how to create this. I already created a big useless machine that did more or less the same, but this one worked purely on mechanics, no arduino or other controlers involved. This one: Kinetic art object Useless machine - YouTube

OK, So what I think I understand:

  • You want motors to be able to act as a "winch" or "Crane", rolling a cable or string up, and rolling it back down again.

  • So you need to be able to reverse the motors, right?

  • You have some windshield wiper motors but you do not want to use the back-and-forth movement, and you will remove that part??

  • You will have to attach some "drum" or "Spool" to wind the cable on.

  • You need to know when the weight is at the top, and stop the motor.

  • You need to know when the weight is at the bottom, and stop the motor.

More questions:
?? How heavy is the weight
?? How long do you want it to take to go from bottom to top / back

OK, I see the Video and idea...

  • So the weight does not need to stop at the bottom??

Details! That's what Engineering is about :smiley:

Hi Doerack!

I'm a 20 year old Megatronics student also from Holland, nice to see I'm not the only one here.
I discovered Arduino just this morning and, though I'm still totally new to Arduino in particular my education does cover these fine electronics and scripting so as I get to know the Arduino systems better I may be able to help you out as a fellow Dutchman.

Groeten van Rik!

rjbvandam:
Hi Doerack!

I'm a 20 year old Megatronics student also from Holland, nice to see I'm not the only one here.
I discovered Arduino just this morning and, though I'm still totally new to Arduino in particular my education does cover these fine electronics and scripting so as I get to know the Arduino systems better I may be able to help you out as a fellow Dutchman.

Groeten van Rik!

Great i will contact u later on!

Hi,

OK, I have a few opinions :open_mouth:

This can certainly be done with Arduino.. It is an interesting idea. I don't want to tell you exactly how to do it, and I think you can experiment and get an example working first, and there is more than one way to do this, like most Engineering things.

  • You need to stop, run and reverse the motors. Two Single-pole Double-Throw relays can do that. When one relay is activated the motor would run in one direction, the other relay activated and it runs the other direction. No or both relays activated and motor stops.

  • You most probably need limit switches at the top and bottom of travel.

  • Just time will not be accurate enough.

  • Counting turns could work, but you still need a known starting point

  • You need limit switches for safety

  • Limit switches should shut off the active relay and signal Arduino. Then Arduino can turn that relay off and later activate the other relay for the other direction.

  • The cable could run through a hole in an arm on a "microswitch" with a "bump" in the cable that catches the switch and switches it.

  • Safety: you should probably measure the usual start/run current on each motor and connect a fuse that will blow if the motor is stalled because something failed and the motor is trying to wind the weight around the drum.

So, you might use a pair of relays for each motor like these:
http://arduino-direct.com/sunshop/index.php?l=product_detail&p=171 DISCLAIMER: I mentioned stuff from my own Shop...! But you can buy these other places too. They already have transistor drivers for the relays so Arduino can run them directly. Or you can build your own.. (The schematic diagram is on the Relay page)..

I suggest you prototype one part of this at a time..

You can obviously build good things.. this is just a different set of tools and materials...

Make sense??

Last question so far: Do you know how to incorporate the PIR sensor? Do I need a sensor shield? (i'm working with 5 PIR sensors, each has to work seperately from the others)

I just used one of those today for writing up in my Arduino-Info Wiki (http://arduino-info.wikispaces.com/)

Take a look here and you will see how I connected them:

See the discussion here: http://arduino-info.wikispaces.com/Brick-Pushbuttons%26OtherSwitches#Motion

A Sensor Shield http://arduino-info.wikispaces.com/SensorShield just makes it easy to connect lots of different things to Arduino without the wiring getting out of control.. With cables that plug in etc.. like on this page: http://arduino-info.wikispaces.com/BrickStarterSet

Terry the links are great, i can work with that!

I will be able to hooking up the different components with the info on the website. First ordering some stuff (i would like to order from your website, but would be sending to the Netherlans be a problem, or get really expensive? I have recieved more electronic components from China, they posted the package as a "gift-package", is that an idea?)

Then hooking it up, en try my luck with the programming. The more i read the more enthousiatic i become of this little arduino board. The options are really limitless! wooohooo!

Hi Mark,

Shipping to Nederlands is not a problem -- the Shipping part.

Nederlands Customs is a problem.. I try to make the value not too high, but Nederlands sometimes charges Customs duty even on the shipping cost! I would try to mark the shipping cost on the outside of the package so they don't charge the Max. Let's email offline on business stuff.. But if you have a good low-cost supplier inside Nederlands, I'm sad to say that might be the best option.

About Starter Sets: It depends on if you are comfortable with wiring things up on a breadboard like these: http://yourduino.com/Breadboard-Wire-Parts.htm but the easy way with lots of different input and output devices you can quickly hook up is an Electronic Brick set like these:
http://arduino-info.wikispaces.com/BrickStarterSet
Click on the image of any device to see more about it, and example software sketches...

Let us know how we can help... you have a cool project in mind there!

DISCLAIMER: I mentioned stuff from my own Shop...

Alright

I've been reading allot, and just trying to hook the diffent parts together, i'm really a newbie, trying to read and understand the different components en how they need to be wired.

What do i want?
I need to stop, run and reverse DC Wiper motors (start current 2ah, drive current 6 ah). To control the motor i want to use a 2-channel relay for the up/down motion.

I'm using the sensor shield.

  • Run motor, use 1 channel of the relay.
  • Reverse motor, the other channel of the relay. (switching the + and - cable makes the motor turn in reverse)
  • Stopping will be done by limit switches (or just use arduino to control the stopping, dont know if that it possible.)

I created an schematic in paint, am i going in the right direction here?

Thanks!

Hi,

The sensor looks right.

I think the motor is a little confused. The Motor has basically 2 terminals you are going to use, right? "GND" and (Pick one of "FAST" or "SLOW"??).. so you need to be able to reverse the connections to BOTH terminals. I would draw it like this:

Tell us if this makes sense??

--- 1 Relay makes it run one way, other relay makes it run the other way. NO or BOTH relays is stop....

Terry thanks for the schematic
I'm using 2 terminals of the motor GND and FAST.

It took me a little while, but i think it does make sense now. Because i cannot read circuit schematics correctly, i always like to make my own visual image that makes sensce to me (that's what art-school makes you do haha).

Yet another drawings! I think i got it right this time :blush:. Please tell me if i'm wrong :).

The sensor is ok now, did i connect the relay correctly? I doubt the IN1 and IN2 connection from the relays to the sensorshield.
Link to image: https://lh6.googleusercontent.com/-ySggLwiAzz4/TeK_ABrHjWI/AAAAAAAABoc/ejuE8HezAJg/Wire%2525202.jpg

This is the second one, did I connect motor relay,s switches and battery correctly?
Link to image: https://lh6.googleusercontent.com/-0zAto-aLUys/TeK_d04gERI/AAAAAAAABog/KCEVEh_4zec/s912/Motor%25252C%252520relays%25252C%252520battery.jpg

If i get this right i can start to think about programming, a whole different challenge!

Alright, i had a little bit of time today so i started to think about writing the code for my art project. I've been reading starterguides and tried to come up with a simple code to control my arduino using a 2-channel relay (hooked up to a dc motor) and a PIR-sensor. It's all really difficult for me, but yopu have to start somewhere. Of course a have a few questions:

In the post before this one, i was working with the different handware components.
Can anyone cofirm i did hook up the different parts correctly?

Before i post my code, i thought that it would be a smart idea to visualize my art project to make it more understandable:
Link to larger image: https://lh6.googleusercontent.com/-oN7VznzigN8/TeUurotmrNI/AAAAAAAABo0/L4zJ6au0pEU/s1440/Artwork%252520sequence%252520%252520finished.jpg

This is the first code i've ever written, go easy on me :* Am i going in the right direction here?

/*

  • PIR sensor tester
    */
int inputPin = 13;                // choose the input pin (for PIR sensor)
int r1Pin = 12;                   // choose the pin for the relay-channel 1 (up)
int r2Pin = 11;                   // choose the pin for the relay-channel 2 (down)
int pirState = LOW;               // we start, assuming no motion detected
int val = 0;                     // variable for reading the pin status
 

void setup()                    // SETUP:runs once
{
  pinMode(inputPin, INPUT);     // declare PIR-sensor as input
  pinMode(r1Pin, OUTPUT);      // declare RELAY-channel 1 as output
  pinMode(r2Pin, OUTPUT);      // declare RELAY-channel 2 as output
 
  Serial.begin(9600);
}
 
void loop()
{
  val = digitalRead(inputPin);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
    digitalWrite(r1Pin, HIGH);  // turn relay-1 (up) ON
    delay(5000);                 // for 5 seconds
    if (pirState == LOW) {
      // we have just turned on
      Serial.println("Motion detected!");
      // We only want to print on the output change, not state
      pirState = HIGH;
    }
  } else {
    digitalWrite(r2Pin, HIGH); // turn relay-2 (down) ON
    delay(5000);              // for 5 seconds
    if (pirState == HIGH){
      // we have just turned of
      Serial.println("Motion ended!");
      // We only want to print on the output change, not state
      pirState = LOW;
    }
  }
}

After a long and hectic time, i'm starting again with the project. Still need to order some parts, but i'm having correspondance about it. Ik would like to ask someone to check out my code, it woul be a great help!

Greetings an overexited art student from the netherlands.

Mark

The parts are being shipped!

Can anyone check my code plz?