Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

Drive Stepper Motor with STEP, DIR, EN Pins

2 posters

Go down  Message [Page 1 of 1]

DreiDe



I like to drive a bipolar stepper motor with an arduino via step, dir and en pins. Similar to this example: https://simulide.forumotion.com/t376-bug-driving-a-stepper-motor-causes-back-steps

However the provided example by TimFisch there doesn't turn the stepper for me at all. I tried to replicate the example myself but have no idea which values would need to be written at which addresses in RAM.

I then decided to use an Attiny44 and just program the behavior myself, however:
1. Sometimes the stepper misses a step at random.
2. I can't get the Attiny44 to work in a subcircuit configuration.

Is it even possible to use micro controllers within subcircuits? Can anyone give me some advice on how to implement such a driver circuit otherwise?
Attachments
Drive Stepper Motor with STEP, DIR, EN Pins AttachmentDriver.zip
Subcircuit Configuration
You don't have permission to download attachments.
(3 Kb) Downloaded 2 times
Drive Stepper Motor with STEP, DIR, EN Pins AttachmentDriver_Sim.zip
Simulation without subcircuit
You don't have permission to download attachments.
(2 Kb) Downloaded 2 times

arcachofo

arcachofo

I like to drive a bipolar stepper motor with an arduino via step, dir and en pins. Similar to this example: https://simulide.forumotion.com/t376-bug-driving-a-stepper-motor-causes-back-steps

However the provided example by TimFisch there doesn't turn the stepper for me at all. I tried to replicate the example myself but have no idea which values would need to be written at which addresses in RAM.
To make this circuit work you need to set ROM to "Asynchronous" in it's properties.
And change output buffers to a clocked latch as shown in the reply post.
Check the circuit attached to this post: stepper-2.zip.

I then decided to use an Attiny44 and just program the behavior myself, however:
1. Sometimes the stepper misses a step at random.
2. I can't get the Attiny44 to work in a subcircuit configuration.
1.- This seems a problem in your sketch: You are reading PINB0 2 times.
2.- You are using old subcircuits. The way subcircuits are created changed sometime ago, have a look here:
https://www.simulide.com/p/new-subcircuits.html
You can use files attached: TMC2130.zip

Is it even possible to use micro controllers within subcircuits? Can anyone give me some advice on how to implement such a driver circuit otherwise?
There is still a bug about firmware path, so you need to place firmware.hex in the same folder than the circuit.
This is already solved in development version (trunk Rev 1385).

Anyway for this case is better to use TimFisch's circuit (with the changes proposed above).
Attachments
Drive Stepper Motor with STEP, DIR, EN Pins Attachmentstepper-2.zip
You don't have permission to download attachments.
(2 Kb) Downloaded 3 times
Drive Stepper Motor with STEP, DIR, EN Pins AttachmentTMC2130.zip
You don't have permission to download attachments.
(3 Kb) Downloaded 3 times

DreiDe



Thanks alot arcachofo for fixing the circuit. Good to know that the fixed voltage-probe subcircuit has been replaced by subcircuits with labels.

With the firmware inside the circuits folder i also got the micro controller version working now.

However making TimFischs Circuit a subcircuit fails with the error "Es gibt keine Datendatei für 8_74XX93". Maybe there is a problem because 74XX93 is a subcircuit itself? Or am I doing something wrong?
Attachments
Drive Stepper Motor with STEP, DIR, EN Pins AttachmentTMC2130.zip
You don't have permission to download attachments.
(2 Kb) Downloaded 1 times

arcachofo

arcachofo

Maybe there is a problem because 74XX93 is a subcircuit itself?
Yes, that is the problem.
It is solved in development version but will not work in 1.0.0

Check version 1.0.1 here:
https://simulide.forumotion.com/t1101-simulide-1-0-1-tester-builds

Version 1.0.1 should also work without hex file in the circuit folder for the Tiny44 subcircuit.

DreiDe likes this post

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum