Hello everyone,
A question about servos; I am using a servo to open and close a door which releases candy; It works by inserting a coin, activates the servo and opens the door to release a certain amount of candys. The problem I had was that sometimes the door stayed a little open and the candys came out continuously; add to the servo SETPOSITION (0. 0) and the problem was corrected, but now the servo maintains a constant vibration on the door, can the servo be kept without vibration? and the door fully closed until a coin is deposited.
Thanks
Enrique
Candy Machine
Moderator: Benj
-
- Posts: 323
- Joined: Sat Jan 12, 2008 2:08 am
- Has thanked: 106 times
- Been thanked: 48 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Candy Machine
Hi Enrique,
Sounds like a sweet project
bad dad jokes there I'm sorry
If you set position 0 and then wait say half a second for the motor to move into position then you can call the disable macro to switch off the motor output. This will cut power to the motor and stop the vibration.
Then when you want to move the motor again just enable it again first.
Sounds like a sweet project


If you set position 0 and then wait say half a second for the motor to move into position then you can call the disable macro to switch off the motor output. This will cut power to the motor and stop the vibration.
Then when you want to move the motor again just enable it again first.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 323
- Joined: Sat Jan 12, 2008 2:08 am
- Has thanked: 106 times
- Been thanked: 48 times
Re: Candy Machine
Hi Benj, I know it sounds very sweet
I use SETPOSITION (0, 0) and then DISABLE SERVO, but sometimes the door opens a little and I wanted that without using a level switch, through programming the door would be kept closed safely. Is there a way to use the function (IF) using some variable (X) to check if the position of the servo is zero 0 ?
The problem is that in a few seconds the content is emptied, when the door is not completely closed.
Enrique

I use SETPOSITION (0, 0) and then DISABLE SERVO, but sometimes the door opens a little and I wanted that without using a level switch, through programming the door would be kept closed safely. Is there a way to use the function (IF) using some variable (X) to check if the position of the servo is zero 0 ?
The problem is that in a few seconds the content is emptied, when the door is not completely closed.

Enrique
-
- Posts: 323
- Joined: Sat Jan 12, 2008 2:08 am
- Has thanked: 106 times
- Been thanked: 48 times
Re: Candy Machine
This is the flowchart I was using. . . .then add the option SETPOSITION (0, 0) in the sequence of the program when it is waiting for the coin to be deposited to make sure the door does not stay open, that's where the vibration started.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Candy Machine
How about a little micro switch on the door to check if it is properly closed?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 323
- Joined: Sat Jan 12, 2008 2:08 am
- Has thanked: 106 times
- Been thanked: 48 times
Re: Candy Machine
I tried with a level switch, but I have the idea of making a few devices and I was looking for a way to simplify the manufacturing and speed up the assembly, trying to correct the fault with software. . .but I think it would be the safest option.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Candy Machine
Hello,
The vibration could be the motor trying to seek to a position it cannot physically get to. It might be better to try and find a nice position where the door is shut and the motor is happy and essentially off. To do this you could move the motor in small increments until the door is shut and then store this shut position into the MCU EEPROM. This might hopefully negate the need for a limit switch and get rid of the vibrations.
The vibration could be the motor trying to seek to a position it cannot physically get to. It might be better to try and find a nice position where the door is shut and the motor is happy and essentially off. To do this you could move the motor in small increments until the door is shut and then store this shut position into the MCU EEPROM. This might hopefully negate the need for a limit switch and get rid of the vibrations.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- AbhijitR
- Posts: 300
- Joined: Fri Nov 07, 2014 12:48 pm
- Location: Pune, India
- Has thanked: 284 times
- Been thanked: 80 times
Re: Candy Machine
Hello! Enrique
Kindly excuse i am not aware of the setup of your project, this is a suggestion if it is possible for you to use a magnetic reed switch then you have a probability of setting the vicinity of operation of the reed switch by placing the magnet close or far as per your requirement, may be you do not get this opportunity while using a mechanical switch.
Abhi
Kindly excuse i am not aware of the setup of your project, this is a suggestion if it is possible for you to use a magnetic reed switch then you have a probability of setting the vicinity of operation of the reed switch by placing the magnet close or far as per your requirement, may be you do not get this opportunity while using a mechanical switch.
Abhi