Hello, i'm new to the Arduino Uno R3, and I need some help with coding. What I want to do is set up a dc motor to be turned on for a specified amount of time when a force-sensitive resistor is activated, however the motor will only be activated once for as long as there is force applied to the resistor, but when you remove and then add the force again, the motor spins for the specified tome again. Anyone know how to code this?
Why use a force sensitive resistor, if it is simply acting as switch?
BrycetheCrafter:
Hello, i'm new to the Arduino Uno R3, and I need some help with coding. What I want to do is set up a dc motor to be turned on for a specified amount of time when a force-sensitive resistor is activated, however the motor will only be activated once for as long as there is force applied to the resistor, but when you remove and then add the force again, the motor spins for the specified tome again. Anyone know how to code this?
I suggest you look through the examples, StateChangeDetection for one, this is a very simple bit of logic
really - start off with a button and an LED though.
The tricky parts will be thresholding/calibrating/debouncing the FSR and choosing the motor and
motor driver or MOSFET - if you tell us about requirements or the motor we can help you avoid the pitfalls.
Can you confirm you only want on-off control in on direction for the motor?
jremington:
Why use a force sensitive resistor, if it is simply acting as switch?
I am creating a pair of self-tying nike mags that will have a force sensitive resistor under the heel insole to activate the motor to tighten the laces
BrycetheCrafter:
I am creating a pair of self-tying nike mags that will have a force sensitive resistor under the heel insole to activate the motor to tighten the laces
This sounds very cool.
As others have suggested, the programming shouldn't be very hard. There are lots of great examples in the IDE.
Once you've learned to control the motors with a button or switch, it wouldn't be too hard to add the FSR to the mix.
There's plenty of people who will be willing to help with the code but I doubt there are many who will write it from scratch.
Do you have your motors yet? How about a h-bridge?
DuaneDegn:
This sounds very cool.As others have suggested, the programming shouldn't be very hard. There are lots of great examples in the IDE.
Once you've learned to control the motors with a button or switch, it wouldn't be too hard to add the FSR to the mix.
There's plenty of people who will be willing to help with the code but I doubt there are many who will write it from scratch.
Do you have your motors yet? How about a h-bridge?
No not yet. I am planing to use a motor that will run off a 9-volt battery at 3 RPS
The 9 volt batteries used for smoke alarms are unsuitable for powering a motor that does useful work.
By far the hardest part of this project will be the electromechanical, shoe tying part. Get that built and working, and we can help with the rest.
+1 to everything jremington just said.
jremington:
The 9 volt batteries used for smoke alarms are unsuitable for powering a motor that does useful work.By far the hardest part of this project will be the electromechanical, shoe tying part. Get that built and working, and we can help with the rest.
This is the motor I am probably going to use. It can run off a 9v battery and provides the RPM I need. The motor is going to tighten the ankle strap on the shoes with the motor installed in the ankle foam backing.
MarkT:
I suggest you look through the examples, StateChangeDetection for one, this is a very simple bit of logic
really - start off with a button and an LED though.The tricky parts will be thresholding/calibrating/debouncing the FSR and choosing the motor and
motor driver or MOSFET - if you tell us about requirements or the motor we can help you avoid the pitfalls.
Can you confirm you only want on-off control in on direction for the motor?
Yes, I want the motor to be turned on for a specified amount of time (Example; 5 seconds) when the FSR is activated, but for it to only spin once for as long as there is force applied. This is the motor I will likely use: http://www.aliexpress.com/item/New-Super-Silent-5pcs-DC-3V-6V-9V-12V-24V-High-speed-motor-Low-torque-Toy/32337770548.html?spm=2114.01020208.3.149.bse3tu&ws_ab_test=searchweb201556_1_79_78_77_91_80,searchweb201644_5,searchweb201560_9
BrycetheCrafter:
This is the motor I will likely use:
I think the mechanical aspect of your project is going to be challenging. That motor hardly seems appropriate without some sort of gearbox. Even with a gearbox, I'm doubtful a 9V would be a good power source. Have you got the mechanical part figured out? I have a hard time imagining that motor (and battery) tightening a shoe.
DuaneDegn:
I think the mechanical aspect of your project is going to be challenging. That motor hardly seems appropriate without some sort of gearbox. Even with a gearbox, I'm doubtful a 9V would be a good power source. Have you got the mechanical part figured out? I have a hard time imagining that motor (and battery) tightening a shoe.
http://www.hscott.net/shoes/ this site shows what I want the general idea to be like. I'm going to take inspiration from his design, make it less bulky ,less messy, less parts, and make the straps tighten faster.
Code for the shoe is posted in the link you gave.
BrycetheCrafter:
http://www.hscott.net/shoes/ this site shows what I want the general idea to be like. I'm going to take inspiration from his design, make it less bulky ,less messy, less parts, and make the straps tighten faster.
That's a cool project. I thought Hunter Scott did a great job. His motor is very different than the one you linked to.
I think the motor/gearbox and power supply are going to be your toughest challenge.
jremington:
Code for the shoe is posted in the link you gave.
His code makes the motor spin slowly. I want my laces to tighten in 1 second. Also, the code is for the Arduino Pro Mini, I am using the Arduino Uno R3
Also, the code is for the Arduino Pro Mini, I am using the Arduino Uno R3
Good choice! The Uno R3 will certainly be smaller than the Pro Mini, and probably fit entirely into the shoe.
BrycetheCrafter:
His code makes the motor spin slowly.
I haven't looked at the code, but I doubt it's the code making the motor spin slowly. The gearbox which increases the torque to a point where the motor won't stall is slowing the speed. Hunter Scott wisely traded speed for torque.
BrycetheCrafter:
I want my laces to tighten in 1 second.
Then you need to become more of an expert on motors and gearboxes than Hunter Scott is. I doubt you'll find a solution with a random motor from Aliexpress. You will likely need to try a variety of motors and gearboxes. You'll also need to figure out how to power the motor gearbox combination you select. My bet is a LiPo cell with a step-up regulator is more likely to succeed at powering the motor/gearbox combo than the 9V battery.
BrycetheCrafter:
Also, the code is for the Arduino Pro Mini, I am using the Arduino Uno R3
Code written for a Pro Mini will work with an Uno.
But I thought you wanted to:
BrycetheCrafter:
make it less bulky
?
Did you know there are Pro Mini clones selling for a few dollars on ebay?
Wait, would I need a separate power supply for the motor and the Arduino, or does the Arduino provide the power for the motor?
Separate.
CrossRoads:
Separate.
Ok, Thanks. I will start looking for a motor that fits my needs