Candy Machine

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Candy Machine

Post by electron67 »

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.
servoDOOR.fcfx
Flow
(12.56 KiB) Downloaded 153 times
Thanks
Enrique

User avatar
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

Post by Benj »

Hi Enrique,

Sounds like a sweet project :D bad dad jokes there I'm sorry :wink:

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.

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Candy Machine

Post by electron67 »

Hi Benj, I know it sounds very sweet :D

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

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Candy Machine

Post by electron67 »

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.
servoDOOR1.fcfx
(13.17 KiB) Downloaded 175 times

User avatar
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

Post by Benj »

How about a little micro switch on the door to check if it is properly closed?

electron67
Posts: 311
Joined: Sat Jan 12, 2008 2:08 am
Has thanked: 104 times
Been thanked: 47 times
Contact:

Re: Candy Machine

Post by electron67 »

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.

User avatar
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

Post by Benj »

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.

User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Re: Candy Machine

Post by AbhijitR »

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

Post Reply