SMT Feeder not working right

07, Jan. 2025

 

Hi,

I have created an SMT feeder whose job is to receive a command via RS485 such as <forward/reverse> using an Atmega328P as the processor on the slave and a Atmega32u4 on the master.

  1. Forward Command
    M600 N F
    e.g M602 15 50
    Where :

  2. M602 is for forward

  3. 15 is the feeder number

  4. 50 is the motor distance

  5. Reverse Command
    M603 N F
    e.g M603 15 50
    Where :

  6. M601 is for reverse

  7. 15 is the feeder number

  8. 50 is the motor distance

The sprocket that moves the tape forward has slot cutouts to count positions like an encoder does. However, it appears that the counts aren't accurate and components in the feeder are not moving proper distance. It's not even a division issue from the looks of it. It's random distances it moves. I checked the output of the reflective sensor and the output has clean square waves, so I know it's not my circuitry 99% sure. See the video here of what I mean by it not moving accurately every time it is told to move to the next part in the tape: Screen Recording 2020 10 16 at 7 37 08 PM - YouTube

I'm wondering if someone can review the code and let me know if there's any errors they can spot when it comes to detecting encoder counts? I wasn't able to embed the code into this post since apparently it's too long and the forum won't let me post it, so I attached it as a file to this post.

Master_Code.ino (2.18 KB)

Slave_Code.ino (8.68 KB)

In both sketches, you are declaring your EnRS485 pin as an OUTPUT. Are these wired together? If so, that is a problem, if one side says it is HIGH and the other says it is LOW, it can't be both at the same time.

Also, in your slave, is_uuid is of type char so this is wrong

strcpy(eeprom_uuid.is_uuid , "y");

Just compare to the char 'y' [note the single quotes]

eeprom_uuid.is_uuid  = 'y';


You have a lot of debugging Serial.print() statements in your code but you did not share any of that output.


...
strcpy(eeprom_uuid.is_uuid , "y");

With high quality products and considerate service, we will work together with you to enhance your business and improve the efficiency. Please don't hesitate to contact us to get more details of Juki SMT Feeder, SMT Machine Accessories, Fuji SMT Feeder.