arduino as a button

hi, this is a little hard to explain. I am making a device that simulates a button being pressed. i need to do this rapidly. currently I am using an arduino uploaded with a sketch similar to the blink sketch and a relay connected to the pin 13. so i am using the relay as a switch and every interval, the relay will be activated and my counter increases. but this will cause ware and tare and its not good for the relay. is there a way i can do it within with the arduino without a relay? thanks for the advice

Hello, can you explain a bit the purpose of the project?
About the relay I'd suggest go with a mosfet (if you dont intend to use with mains voltage) (to get rid of the relay's special needs)

hi, ok the purpose is dumb actually. i have a bike cadence meter that was accidentally reset and i am trying to get back the past records. so long story short, a press of a button = a tyre rotation. i need to run it for 9 hours based on calculations to get back my actual value..... my relay is flickering on and off now to simulate a press button. so my relay will have to go through alot of work. thats y if there is a way to do it with an arduino, it will be great.

ok, it sounds simple.. i would try to hack the sensor , then i would use a small bc547 transistor from a digital output to click the sensor..

9 hours = 540minutes = 32400 seconds

int outPin = 7;

void setup()
{
  pinMode(outPin, OUTPUT);   
}

void loop()
{

for (int i=0; i <= 32400; i++)

{  
  digitalWrite(outPin, HIGH);  
  delay(100);                  // waits for 0.1 sec
  digitalWrite(outPin, LOW);  
  delay(900);                  // waits for 0.9 sec
   } 
}

The code is for running it 9 hours, however you can decrease the interval, but dont do it too short as sensor may have a limit in reading..

Also, you need to clarify the frequency of cycles... i.e. you can hit 6 turn/sec..
i calculated it as 1 per second

Hope I've helped some

i need to run it for 9 hours based on calculations

What calculations?

hi, thanks for the replies, for example now my relay is turning off and on at a frequency = to 47.1 kmh per hour..... i need it to reach 400 ++ km so its around 9 hours ++..will using a transistor have any current passing through it? initially i though about using a transistor, but am not sure if it will damage the cadence meter or not.

It shouldn't damage your meter if you wire it up properly! And connect the grounds.

By using a solid state circuit you can run it at a much faster rate if you so desire, saving time. Unless you need to run at that frequency for a specific reason.

However, by the time you have researched this and investigated the circuit your relay system will probably have done the job.

in order to calculate the frequency , I need your tyre circumference. is it 26" and 1.5" tire profile ?

connect common grounds , and take 1 wire of the sensor through collector and emmiter of the transistor, but check first where's the polarity

that's a draft idea, and the schematic is wrong but im in a rush now!

hi, yes my design has almost done the job actually haha but im just curious incase i need to do it again (hopefully not) thanks for the transistor design! taking a look at it now!

hi! thanks for your help!! now speeding up at 300 km per hour!! with no relay =)

btw i did not use a transistor. just a resistor did the job =)

Hehe no matter what... all that counts is the result! Speed it more , take a picture and put it next to a lamborghini

Hahaha i took a picture of it! cycling faster than a Lamborghini ! now my bikes cadence meter shows that my maximum speed is 300 km/h hahaha gonna brag to the other cyclist =p joking

photo.JPG

he he are you trying to cheat your coach ? ?

hahahaha my coach will ask me to prove it lol.