Arduino Forum upgrade scheduled for Monday, October 20th, 11am-4pm (CEST). Sorry for the inconvenience!
Pages: [1]   Go Down
Author Topic: 2 potmeters, 1 proximity switch  (Read 1336 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 Hello everybody,

First HAPPY NEW YEAR for everyone.

I'am trying to operate a sheetmetal deforming machine with a arduino uno.
The mecanial/hydraulic part of the machine is not the problem for me.
But giving the arduino the right instructions that's new for me.
I have studied a lot samples of codes and posts to learn to understand programming the arduino.
The code of the blinking led with delay using a potmeter is a good start with for my application. I think?
For my machine i use 2 potmeters, 1 proximity switch.
1 Potmeter does the same like the blinking led sample.
I changed the led for a relay, to oprate a hydraulic valve.
So far so good.
The machine i make is a simple big hammer operated with a hydraulic cilinder. Hammering metal sheet plates.
If the hammer comes down and gives a hit directly afther that, it must go up. it may not rebound.
Therefor i wil use a proxswitch to 'see' when de hammer is down.
Potmeter 2 i will use is to adjust the rising time. (when to rise)
Question, am i thinking in the right direction to create a code for this application???
Any help for the code should be helpfull.
By the way, this is a hobby project to rebuild a very old car.

Thanks
Logged

Atlanta
Offline Offline
Sr. Member
****
Karma: 1
Posts: 255
Arduino still rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Sounds like youre saying :  :  :
Double acting cylinder and valve controled by ONE relay.
Relay makes hammer go all the way UP in (which?) relay position
Relay makes hammer go all the way DOWN in other relay position
You want hammer UP for X time, then DOWN to strike a piece, wait for Y time and them back UP ?
You want the 2 potentiometers to adjust the timeUP and timeDOWN?
You got a prox sensor to tell when hammer is DOWN?

Have we got this right so far?

You probably need a START / STOP also.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for the reply so quick.

If the hammer goes up, the relay is actuated.
If the hammer goes down (freefall) the relay is not actuated.
I want hammer UP for X time, then DOWN to strike a piece, wait for Y time and them back UP.
One potmeter for the time up.
The other potmeter for the wait' time to go up.
And yes one prox sensor to see when the hammer is down.
For start and stop function i can power up/power down.
The hammer is always in the down position.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I mean the hammer is always down when starting. smiley
Logged

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 43
Posts: 5628
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Rather than a proximity switch, if you could somehow isolate the tool end from the sheet metal, such that when the two contact each other, they form the "contacts" of a switch, that would be better than a separate switch. Note that there will likely be a form of resistance (because the metal you are working likely won't be shiny brand new, or may not be extremely conductive, or may be dirty, etc), so your actual switch would consist of the tool contact the metal, which would likely go into an op-amp or a comparator of some sort - and on the Arduino side in software (or external with hardware) you would want to debounce the switch.

Another possibility would be an optical sensor of some sort; or maybe something like a piezo "knock" sensor that could listen for the strike.

Lastly - will there be any safety considerations for this tool, or are you of the "pray not to lose fingers" school of metal work...?  ;D
Logged

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A optical switch wil do.
The idea of isolating the tool is a practical problem.
Dónt worry about my fingers!!
The reason that the hammer must lift upwards after the hit is to move the sheetmetal a little bit.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is the code where i started with.

int sensorPin = A0;   // select  pin for potentiometer          
int ledPin = 12;         // select  pin for LED/relay 12                  
int sensorValue = 0; // variable to store the value coming from the sensor
int proxpin = 7;        // select pin for proxswitch       -

void setup() {
  
  pinMode(ledPin, OUTPUT);  // declare the ledPin as an OUTPUT:
}

void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);    
  // turn the ledPin on
  digitalWrite(ledPin, HIGH);  
  // stop the program for <sensorValue> milliseconds:
  delay(sensorValue);          
  // turn the ledPin off:        
  digitalWrite(ledPin, LOW);  
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);                  
}
Logged

Pages: [1]   Go Up
Arduino Forum upgrade scheduled for Monday, October 20th, 11am-4pm (CEST). Sorry for the inconvenience!
Jump to: