Go Down

Topic: 2 potmeters, 1 proximity switch (Read 1 time) previous topic - next topic


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.



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.


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.


I mean the hammer is always down when starting. :)


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
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.


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.


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:
 // turn the ledPin off:        
 digitalWrite(ledPin, LOW);  
 // stop the program for for <sensorValue> milliseconds:

Go Up