Creating a state machine to make ice

My language is Portuguese so sorry for any errors in the text

I recently read a topic here on the same subject but it was closed and I didn't see if there was a solution.

n short, I have this same ice machine and it also has problems with the control board processor...

the machine itself physically has inputs and outputs that are

1 high limit switch ice tray
2 low limit switch ice tray

3 water level sensor
4 water flow sensor

5 push botto to reset
6 PUSh buttom to select ice cube

I can also use a bin sensor full of ice that will be unfastened at the moment.

and the outputs are 4, being them

1 up/down ice tray motor
2 water pump
3 compressor
4 heating solenoid

and the machine routine in my logic should be

1 boot.

2 move ice tray to ensure unblocking
3 move the ice tray to the high position
4 check if there is a level off water

5 open the option to select cube size (the machine does this for the time that will be used later)

6 fill ice tray (the machine needs 5 seconds to do this, but it doesn't matter if it overflows as the water returns to the reservoir)

7 turn on the compressor (only turn it off if there are faults)

then we have the beginning of the LOOP

8 Leave the selected time there at the beginning to run.

9 lower the ice tray

10 turn on the solenoid for 5 seconds so that the cubes fall

11 raise the ice tray again

12 Fill the ice tray again for 10 seconds

return to loop in step 8

This whole routine would only stop in 3 situations

a) lack of water
b) lack of flow during filling
c) error in ice tray movement

But not everything is perfect....

The motor that drives the tray is an AC motor, like a microwave turntable. cc/ccw

and for it to "reverse the rotation" without electronic control... my life is difficult

I know that if I turn it on and off, the forward direction is due to the Hertz issue.

Then you turn it on and off and it may invert the speeds, it takes up to 3 pulses for it to work

But I also know that if the ice tray is in one position and the engine is turned on, the contact that is closed should open, so I thought of the following logic

It turns on the motor if the contact is open, it pulses the motor until the contact opens, then it only turns off the motor when the target contact is closed.... this is beautiful and wonderful....

but I'm a zero at programming

vamos trabalhar, por que o chatgpt nao conseguiu me ajudar em 3 dias programando juntos

Welcome to the forum

You started a topic in the Uncategorised category of the forum when its description explicitly tells you not to

Your topic has been moved to a relevant category. Please be careful in future when deciding where to start new topics

1 Like

Sorry, I didn't know which Arduino category to put it in, I put it in the uncategorized one... maybe it's the language problem

can you pls give the link, i want see pictures

Main with code and drawings...

PDFs...

Part 1

Part 2

Part 3

where do you want the link??? What did I read about these machines???

Forget it, I read it here on this forum and nothing was resolved...

Now if you want to see photos of the machine I have I can take them, but I don't even know if I can post them here

just drop the picture in post or Ctrl-C/Ctrl-V

I've already read your first PDF, interesting material...

but it doesn't even come close to my main problem...

because the state machine with the sequence I want chatgpt wrote for me, it would even work with small adjustments...

If the motor that moves the tray was different....

the motor is the same as the one in microwaves> and there is no logic that makes the Arduino understand (at least I can't)

When you turn the engine on, it's like Russian roulette... it can turn right or left... randomly...
But if it turns left and you want it to turn right, just turn it off and turn it on again quickly and it goes back in the opposite direction.

means something komplete different as random rotation direction



I choose J. Bellavance. Have fun.

I already turned on the machine, it was with the high switch closed and I saw the trigger FORCE to the side that was activated after a while it reversed the rotation and made the expected movement I went to the opposite side to activate the other switch

i have such motor, for micro wave oven it is ok, but for your need better normal DC motor with gear.
do you can to make schematic from this setup? what is this control board? if we know µC and used pins we would be able to write own Firmware.
for successful using of chatgpt you must be a professional to recognise errors and correct them or force AI to correct it for you. too much effort, easier is to write self.

1 Like

imagine the situation
switch up CLOSED
(the tray is UP)

of machine need tray down( obviously switch down open)

simply start the engine
then the engine keeps FORCING in the REVERSED direction

I would need something like this

Look, you have to leave here and go there, but if the one here doesn't open in 0.5 seconds, turn it off and on again, then just turn it off until it opens and then just turn it off when it closes.

the whole machine works, but the controller is CRAZY.... it makes ice for 2 cycles and starts to show problems, I turn it off and it does 2 cycles again and it freezes, on Saturday I made ice all day, turning off the machine every 30 minutes

I got bored and I'm going to remove this board and use an Arduino.... MUCH SMARTER, with the option of an LCD display, with more visual information than just a pair of LEDs emitting blinks

or in direct direction

ok. make the circuit and draw a schematic.

tinkercad is not convenient

Can I post tinkercad link here??

WHAT A Pity I even have the entire system APPLIED, just click and simulate

including a code that recognizes the high tray in movement or low

do you have already entire system in tinkercad? let see.