Welcome Guest! To enable all features please Login or Register.
Options
Go to last post Go to first unread
nbourg8@gmail.com  
#1 Posted : Friday, November 18, 2016 12:38:30 PM(UTC)
nbourg8@gmail.com

Rank: Newbie

Groups: BetaUser, Registered
Joined: 11/11/2016(UTC)
Posts: 6

This is easy to do in the Arduino IDE but I'm having trouble replicating in the Embrio platform. Especially when controlling the turn speed.

My issue is, in the Arduino IDE, I can call delayMicrosecond(x) to control the speed and simply force a digital pin from HIGH to LOW and back to HIGH until a counter reaches the number of steps I want.

Is this even possible in Embrio? If so, I'm using the BigEasyDriver with a 4 wire Nema 17 Stepper Motor where each step is .9 degrees.

Feedback is extremely valuable to me and I appreciate the help.
EmbrioAdmin  
#2 Posted : Friday, November 18, 2016 3:10:23 PM(UTC)
EmbrioAdmin

Rank: Administration

Groups: Administrators
Joined: 12/11/2014(UTC)
Posts: 661

Thanks: 1 times
Was thanked: 109 time(s) in 104 post(s)
Yes it's possible, but I'm not sure exactly what you are trying to do. How much time do you want to wait between setting the pin high and low? Copy and paste the XML below into an empty Agent. I copied the Arduino code for the custom node from here. That node has a trigger, and when it fires it turns the pin high for 1 millisecond and then turns it off. It's best not to use Delay in Embrio nodes and instead use other nodes for the timing, but in this case if you need to be precise and have the pin high for 1 ms this is the best way. The rest of the nodes are a bit jumbled, but basically when the program starts, a switch is turned on and a timer is started. When the timer fires once per second, the incrementer is fired. When the incrementer is full it turns off the switch. When the switch is on the timer trigger passes through to the custom Arduino node. (This made me realize that the behavior of the Increment node should probably be that the Triggered output trigger doesn't fire when the incrementer is full, this way we could do without the switch and Trigger Is Active node, I'll probably change that at some point).

So this example shows how to force a pin high and low using Arduino code (which you should be wary of unless you need the precision) and how to use a timer to fire a trigger to do the incrementing.

If any of that doesn't make sense or you need some more help let me know.

<EmbrioCopy>
<Version>1.3.6.0</Version>
<Nodes>
<Node>
<UniqueID>f0edbb57-6b92-4cca-911d-afb3e5148b9e</UniqueID>
<AssemblyType>Embrio.NodeEngine.AgentController.Nodes.AgentControllerCustomArduinoNode</AssemblyType>
<NodeType>Custom Arduino Node</NodeType>
<UserDefinedName></UserDefinedName>
<Description>A node that lets you write any Arduino code to interact with the Arduino hardware. Can be both an input and output.</Description>
<NodeColor>144,183,227,255</NodeColor>
<X>1249</X>
<Y>204</Y>
<Width>542</Width>
<IncludeCode></IncludeCode>
<DeclerationCode>//Declare pin functions on Arduino
#define stp 2
#define dir 3
#define MS1 4
#define MS2 5
#define MS3 6
#define EN 7</DeclerationCode>
<SetupCode>pinMode(stp, OUTPUT);
pinMode(dir, OUTPUT);
pinMode(MS1, OUTPUT);
pinMode(MS2, OUTPUT);
pinMode(MS3, OUTPUT);
pinMode(EN, OUTPUT);</SetupCode>
<ImageName>arduino.png</ImageName>
<InfoURL></InfoURL>
<IsOpen>True</IsOpen>
<EditWidth>360</EditWidth>
<CodeDefinitions>
<CodeDefinition>
<TriggerInputID>76fe7154-67ea-46fe-bcd4-3496c8131fc6</TriggerInputID>
<UpdateCondition>Trigger</UpdateCondition>
<Code>digitalWrite(stp,HIGH); //Trigger one step forward
delay(1);
digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again
</Code>
<UniqueID>e34fb085-a9a7-4e78-afd1-6a875761d959</UniqueID>
</CodeDefinition>
</CodeDefinitions>
<Inputs>
<Input>
<UniqueID>76fe7154-67ea-46fe-bcd4-3496c8131fc6</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Trigger</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>True</IsUserAdded>
<ConnectedOutputs>
<Output>336e97ec-d601-4122-98cb-38bcc3f9bcf7</Output>
</ConnectedOutputs>
</Input>
</Inputs>
<Outputs></Outputs>
</Node>
<Node>
<UniqueID>3acd1009-0336-49b9-b764-f72f74a4c4be</UniqueID>
<AssemblyType>Embrio.NodeEngine.AgentController.Nodes.DynamicNode</AssemblyType>
<NodeType>Trigger If Active</NodeType>
<UserDefinedName></UserDefinedName>
<Description></Description>
<NodeColor>229,229,197,255</NodeColor>
<X>947</X>
<Y>237</Y>
<Width>260</Width>
<DefinitionID>77c1ae22-af0d-4fbe-9de4-74b16d49af65</DefinitionID>
<Inputs>
<Input>
<UniqueID>84832add-8aa2-43ac-a804-73aa7c45c91e</UniqueID>
<DefinitionID>fa621797-7d67-43f0-9d97-8feca53fbab2</DefinitionID>
<DefaultName>Activation</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Numeric</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.NumericNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs>
<Output>cdec584b-f365-4737-aeea-c70bb1681dfa</Output>
</ConnectedOutputs>
<BlendMode>Add</BlendMode>
<DisconnectedValue>0</DisconnectedValue>
<UseNegativeRange>False</UseNegativeRange>
<CanUseNegativeRange>True</CanUseNegativeRange>
</Input>
<Input>
<UniqueID>8b2b788e-0314-4372-a67e-f0076eca8af4</UniqueID>
<DefinitionID>7b879b29-ac4b-4296-8f4d-3c68a9f3c2d0</DefinitionID>
<DefaultName>Threshold</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Numeric</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.NumericNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs></ConnectedOutputs>
<BlendMode>Add</BlendMode>
<DisconnectedValue>0.503</DisconnectedValue>
<UseNegativeRange>False</UseNegativeRange>
<CanUseNegativeRange>True</CanUseNegativeRange>
</Input>
<Input>
<UniqueID>fcb533a7-3fbb-41ad-9888-aa6a673a95d7</UniqueID>
<DefinitionID>4dbb134f-9fed-4b08-9908-ff421b587ea0</DefinitionID>
<DefaultName>Trigger</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs>
<Output>6dc03b7d-3852-4257-9cca-2910f7ae9d5a</Output>
</ConnectedOutputs>
</Input>
</Inputs>
<Outputs>
<Output>
<UniqueID>336e97ec-d601-4122-98cb-38bcc3f9bcf7</UniqueID>
<DefinitionID>39d0c261-38f0-4c58-9b38-c2e359816224</DefinitionID>
<DefaultName>Trigger</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
<Output>
<UniqueID>1dface62-78a1-46f4-984e-661276dcc83f</UniqueID>
<DefinitionID>22ea899c-e56d-4c53-8d69-d10612e06742</DefinitionID>
<DefaultName>Blocked</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
</Outputs>
</Node>
<Node>
<UniqueID>0ed0cb27-96d2-442b-99a1-8bfd6bb4956b</UniqueID>
<AssemblyType>Embrio.NodeEngine.AgentController.Nodes.DynamicNode</AssemblyType>
<NodeType>Increment</NodeType>
<UserDefinedName></UserDefinedName>
<Description></Description>
<NodeColor>201,204,227,255</NodeColor>
<X>646</X>
<Y>58</Y>
<Width>260</Width>
<DefinitionID>7e28b1ed-190c-427d-a427-ec5d460b78e6</DefinitionID>
<Inputs>
<Input>
<UniqueID>cc375d26-69a9-4e8f-ae08-6d51f2063652</UniqueID>
<DefinitionID>608e2928-bd26-4938-9c24-74b83ea8dc3f</DefinitionID>
<DefaultName>Trigger</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs>
<Output>126d3060-bff5-4212-9d76-15bf9feb9e78</Output>
</ConnectedOutputs>
</Input>
<Input>
<UniqueID>007b59fb-d994-43f2-b7c9-3fd67e0cc4ef</UniqueID>
<DefinitionID>8a707311-d645-4723-93c3-48e1eb763612</DefinitionID>
<DefaultName>Reset</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs></ConnectedOutputs>
</Input>
</Inputs>
<Outputs>
<Output>
<UniqueID>b279ba85-c566-4b22-9cf7-3be6d477b224</UniqueID>
<DefinitionID>5e2219f3-6540-4d5c-824e-c395fc79b7e3</DefinitionID>
<DefaultName>Value</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Integer</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.IntegerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<MinValue>0</MinValue>
<MaxValue>10</MaxValue>
</Output>
<Output>
<UniqueID>6dc03b7d-3852-4257-9cca-2910f7ae9d5a</UniqueID>
<DefinitionID>9ad60d98-2931-4a02-9b7d-d59edba83c3b</DefinitionID>
<DefaultName>Triggered</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
<Output>
<UniqueID>7206c767-0bad-4c7d-a416-5ef491cdfcdc</UniqueID>
<DefinitionID>1dbe85ab-ff9e-407c-ba66-737d1053477c</DefinitionID>
<DefaultName>Become Full</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
<Output>
<UniqueID>0dfac39d-283d-40cd-b5a8-3caa45d410d4</UniqueID>
<DefinitionID>a26c6b3a-b4da-40cb-a055-36d5c759c659</DefinitionID>
<DefaultName>Already Full</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
<Output>
<UniqueID>dc6bcd19-b74d-44c4-9036-4eb2ae58fb3e</UniqueID>
<DefinitionID>14df6a91-26a2-4069-9f22-99e3cac14d6c</DefinitionID>
<DefaultName>Reset</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
</Outputs>
</Node>
<Node>
<UniqueID>4b65110b-d9e5-4f9b-a788-ff5ffa6dba30</UniqueID>
<AssemblyType>Embrio.NodeEngine.AgentController.Nodes.DynamicNode</AssemblyType>
<NodeType>Switch</NodeType>
<UserDefinedName></UserDefinedName>
<Description></Description>
<NodeColor>229,229,197,255</NodeColor>
<X>644</X>
<Y>310</Y>
<Width>260</Width>
<DefinitionID>13030c99-98ce-4f5b-bdc5-5ee155eac37c</DefinitionID>
<Inputs>
<Input>
<UniqueID>8c4c4a7a-3e47-40a6-83d2-d03b0b9956e6</UniqueID>
<DefinitionID>a8114d67-28ba-43a7-b292-5065f966dde3</DefinitionID>
<DefaultName>On Value</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Numeric</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.NumericNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs></ConnectedOutputs>
<BlendMode>Add</BlendMode>
<DisconnectedValue>1</DisconnectedValue>
<UseNegativeRange>False</UseNegativeRange>
<CanUseNegativeRange>True</CanUseNegativeRange>
</Input>
<Input>
<UniqueID>b7377526-cf05-4e27-a3fc-740d2f17f3a9</UniqueID>
<DefinitionID>88d36748-1367-442a-997a-1055f1fe32f4</DefinitionID>
<DefaultName>Off Value</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Numeric</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.NumericNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs></ConnectedOutputs>
<BlendMode>Add</BlendMode>
<DisconnectedValue>0</DisconnectedValue>
<UseNegativeRange>False</UseNegativeRange>
<CanUseNegativeRange>True</CanUseNegativeRange>
</Input>
<Input>
<UniqueID>f7732571-3668-44bc-bdf9-053cad6d2b43</UniqueID>
<DefinitionID>b53a92f7-c2ee-4c85-a58b-3bbc75dafae0</DefinitionID>
<DefaultName>Turn On</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs>
<Output>f27ad413-69bb-46af-966d-e1870c9311ce</Output>
</ConnectedOutputs>
</Input>
<Input>
<UniqueID>17a9bcfc-5b8e-4239-937f-596757832fe1</UniqueID>
<DefinitionID>f892a324-2a05-4132-bbe1-e4038aad4f0f</DefinitionID>
<DefaultName>Turn Off</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs>
<Output>7206c767-0bad-4c7d-a416-5ef491cdfcdc</Output>
</ConnectedOutputs>
</Input>
<Input>
<UniqueID>eb6afcab-e415-4a0f-b5de-fd539f23adb0</UniqueID>
<DefinitionID>e6265564-36b2-4ca6-8da9-4516345f3a7e</DefinitionID>
<DefaultName>Toggle</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs></ConnectedOutputs>
</Input>
</Inputs>
<Outputs>
<Output>
<UniqueID>cdec584b-f365-4737-aeea-c70bb1681dfa</UniqueID>
<DefinitionID>5298cec5-3257-4ea1-9ed0-0f06b7be1293</DefinitionID>
<DefaultName>Activation</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Numeric</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.NumericNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<MinValue>0</MinValue>
<MaxValue>1</MaxValue>
<UseNegativeRange>False</UseNegativeRange>
<CanUseNegativeRange>True</CanUseNegativeRange>
</Output>
<Output>
<UniqueID>1eb28e59-4b0b-412b-8e65-33628b453128</UniqueID>
<DefinitionID>a20f60f2-2608-48db-92cf-90be81dcb5b6</DefinitionID>
<DefaultName>Turned On</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
<Output>
<UniqueID>2025f8db-6999-47f8-8937-28f24db73608</UniqueID>
<DefinitionID>c67e21ce-6ec8-4048-9973-3cedb4ee8927</DefinitionID>
<DefaultName>Turned Off</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
<Output>
<UniqueID>a6aeed33-a82f-4796-b439-8d5e887ba38b</UniqueID>
<DefinitionID>52f1e9c7-efa8-48db-8a10-7dd671aa74ae</DefinitionID>
<DefaultName>Toggled</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
</Outputs>
</Node>
<Node>
<UniqueID>294e2228-1ab4-4ff2-b2f8-22bdc9775625</UniqueID>
<AssemblyType>Embrio.Nodes.FlowControl.TimerNode</AssemblyType>
<NodeType>Timer</NodeType>
<UserDefinedName></UserDefinedName>
<Description>An output activation changes based on a timer. The maximum number of seconds can be changed on the node, and the duration input scales the actual time used. Triggers fire when the timer is started, stopped, finished, and restarted.</Description>
<NodeColor>229,229,197,255</NodeColor>
<X>312</X>
<Y>0</Y>
<Width>260</Width>
<EndBehavior>MinValue</EndBehavior>
<MaxTimeSeconds>1</MaxTimeSeconds>
<Inputs>
<Input>
<UniqueID>d0a282a6-b366-474f-8bb5-60d196d96f6f</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Start</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>True</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs>
<Output>126d3060-bff5-4212-9d76-15bf9feb9e78</Output>
<Output>f27ad413-69bb-46af-966d-e1870c9311ce</Output>
</ConnectedOutputs>
</Input>
<Input>
<UniqueID>8d3e3d2a-b99f-47c7-a7d8-c7dd8ce1df55</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Stop</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>True</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs>
<Output>7206c767-0bad-4c7d-a416-5ef491cdfcdc</Output>
</ConnectedOutputs>
</Input>
<Input>
<UniqueID>c5fb8bea-a2cb-42e6-ae5a-5f86082ea343</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Restart</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>True</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs></ConnectedOutputs>
</Input>
<Input>
<UniqueID>62ec3442-dbd7-4de7-bba9-124fb3a874d3</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Duration</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>True</IsNative>
<TypeName>Numeric</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.NumericNodeInput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<ConnectedOutputs></ConnectedOutputs>
<BlendMode>Add</BlendMode>
<DisconnectedValue>1</DisconnectedValue>
<UseNegativeRange>False</UseNegativeRange>
<CanUseNegativeRange>True</CanUseNegativeRange>
</Input>
</Inputs>
<Outputs>
<Output>
<UniqueID>f077cddd-8dad-457a-8ce9-04fb124a098d</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Started</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>True</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
<Output>
<UniqueID>126d3060-bff5-4212-9d76-15bf9feb9e78</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Finished</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>True</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
<Output>
<UniqueID>4eb5a355-1663-4ea3-8b14-0ff6beb64d80</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Stopped</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>True</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
<Output>
<UniqueID>0d66c856-f91f-4b89-bf8a-9b125ed3838b</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Restarted</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>True</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
<Output>
<UniqueID>60c1e03b-f647-416e-8dc5-8f05671082be</UniqueID>
<DefinitionID>00000000-0000-0000-0000-000000000000</DefinitionID>
<DefaultName>Output</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>True</IsNative>
<TypeName>Numeric</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.NumericNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
<MinValue>0</MinValue>
<MaxValue>1</MaxValue>
<UseNegativeRange>False</UseNegativeRange>
<CanUseNegativeRange>True</CanUseNegativeRange>
</Output>
</Outputs>
</Node>
<Node>
<UniqueID>7d56c806-032b-4ea1-ad86-ad38524cfc88</UniqueID>
<AssemblyType>Embrio.NodeEngine.AgentController.Nodes.DynamicNode</AssemblyType>
<NodeType>Startup Trigger</NodeType>
<UserDefinedName></UserDefinedName>
<Description></Description>
<NodeColor>229,229,197,255</NodeColor>
<X>0</X>
<Y>216</Y>
<Width>260</Width>
<DefinitionID>c9315389-c2e7-4f40-bcfe-8a678ef89373</DefinitionID>
<Inputs></Inputs>
<Outputs>
<Output>
<UniqueID>f27ad413-69bb-46af-966d-e1870c9311ce</UniqueID>
<DefinitionID>9533a00b-d9fd-472e-a2d9-739a7be82c2e</DefinitionID>
<DefaultName>Trigger</DefaultName>
<CustomName></CustomName>
<IsDisplayed>True</IsDisplayed>
<IsNative>False</IsNative>
<TypeName>Trigger</TypeName>
<IsOutsideConnection>False</IsOutsideConnection>
<IOType>Embrio.NodeEngine.NodeIO.TriggerNodeOutput</IOType>
<ShowGraph>False</ShowGraph>
<LinkedIOID>00000000-0000-0000-0000-000000000000</LinkedIOID>
<IsUserAdded>False</IsUserAdded>
</Output>
</Outputs>
</Node>
</Nodes>
</EmbrioCopy>
nbourg8@gmail.com  
#3 Posted : Friday, November 18, 2016 7:12:30 PM(UTC)
nbourg8@gmail.com

Rank: Newbie

Groups: BetaUser, Registered
Joined: 11/11/2016(UTC)
Posts: 6

Well I copy/pasted this into Embrio, changed the pins to my board, added digitalWrites for MS1, MS2, MS3 set to HIGH and EN set to LOW.

I understand the thought process you used and it is quite nice, but the practical world of stepping once every second is way too slow. Even adjusting the timer to 0.001 (the smallest it can go) is too slow.

I can feel the stepper move, but only feel it, cannot see it.

If I copy and paste the code block, setup and declarations into Arduino IDE, everything works fine and operates the stepper quite nicely. Also using delay instead of delayMicroseconds is too slow.

Is there a way to increase the RPM?

Below is the working code in Arduino IDE (a copy paste from embrio).
/*
* Stepper_Test.ino
*
* Created: 7/7/2014 10:43:56 PM
*/
//Declare pin functions on Arduino
#define stp 7
#define dir 8
#define MS1 11
#define MS2 10
#define MS3 9
#define EN 12

void setup()
{
pinMode(stp, OUTPUT);
pinMode(dir, OUTPUT);
pinMode(MS1, OUTPUT);
pinMode(MS2, OUTPUT);
pinMode(MS3, OUTPUT);
pinMode(EN, OUTPUT);
}

void loop()
{
digitalWrite(MS1,HIGH);
digitalWrite(MS2,HIGH);
digitalWrite(MS3,HIGH);
digitalWrite(EN, LOW);
digitalWrite(stp,HIGH); //Trigger one step forward
delay(1);
digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again
}
EmbrioAdmin  
#4 Posted : Friday, November 18, 2016 9:01:00 PM(UTC)
EmbrioAdmin

Rank: Administration

Groups: Administrators
Joined: 12/11/2014(UTC)
Posts: 661

Thanks: 1 times
Was thanked: 109 time(s) in 104 post(s)
By default an agent updates 32 times per second. You can change that in the bottom right of the node screen. Also if you want the stepper code to run on every update you can use a "trigger every update" node instead of the timer.

If you let me know a bit more about what your project will be doing maybe I can help more, and maybe it will lead to an improvement in the software to deal with a situation I have not already anticipated. I have not experimented much with stepper motors yet so I'm unsure of the specific challenges.
nbourg8@gmail.com  
#5 Posted : Friday, November 18, 2016 11:18:57 PM(UTC)
nbourg8@gmail.com

Rank: Newbie

Groups: BetaUser, Registered
Joined: 11/11/2016(UTC)
Posts: 6

http://i66.tinypic.com/2vcx9xj.png
http://i66.tinypic.com/wgu8if.png

This is a solidworks depiction of my project. You can see a small motor rotates a threaded shaft to which the up/down aiming is attached. The left/right is adjusted via the wooden gear turned by another motor. Both of these motors must be precise, move a short distance and quick. I realize a strong servo would likely be optimal, but I am trying to work with what I have and the only servo I have is the tiny hobbyist one. Instead I have some decently sized stepper motors that I'd like to make use of.

While the DC motor operation is simple and elegant with Embrio, the Stepper motors have proven a nightmare. Obviously, tennis is a fast paced sport, so turning quickly is important.

And besides, a servo is easy, let's tackle something with a little more pizazz!

Edited by user Saturday, November 19, 2016 12:53:02 AM(UTC)  | Reason: Not specified

EmbrioAdmin  
#6 Posted : Saturday, November 19, 2016 11:53:53 AM(UTC)
EmbrioAdmin

Rank: Administration

Groups: Administrators
Joined: 12/11/2014(UTC)
Posts: 661

Thanks: 1 times
Was thanked: 109 time(s) in 104 post(s)
You might want to try putting all of the code to shoot your tennis ball into a custom Arduino node and have a trigger fire it. That way Embrio will control the overall program timing, then when you need the temporary fast control to shoot the tennis ball that part of the program will take over for the shooting. There are always going to be some things best done in code than visual and this might be one of them.

The other option is to put your stepper motor node in an agent running at the fastest refresh rate. Currently that's set to 128 updates per second, but it could be set higher. If you fire the node on every update it will fire every 7.8 milliseconds at that refresh rate. If that makes the performance better, having it run at 512 updates per second might be worth a try. Currently the limit is set to 128 but there's no real reason to set it higher, if you want to try that e-mail me at ezra@embrio.io and I'll send you a dll that lets you use a higher refresh rate to try out. I'll get myself a stepper motor to play around with too, they are pretty common and Embrio should be able to use them nicely.
nbourg8@gmail.com  
#7 Posted : Sunday, November 20, 2016 9:25:33 AM(UTC)
nbourg8@gmail.com

Rank: Newbie

Groups: BetaUser, Registered
Joined: 11/11/2016(UTC)
Posts: 6

7.8 milliseconds is not within the operating range that the stepper motor requires for smooth and quick operation. It really requires around 15 Microseconds to operate optimally.

When I change the Refresh from 32 to 128, the stepper actually moves slower... like MUCH slower... maybe 1 step per second. Mind boggling...

I created an easy project structure and zipped it up for your review. It also contains AccelStepper.h as an include because I'm using the BigEasyDriver to power the stepper since it requires around 0.5A and the Arduino is not that powerful. The BigEasyDriver does have a potentiometer to adjust amperage to the Stepper, and I'm staying on top of that thing, but it doesn't help in this case.

You can find this zip file in your email you provided. I'd be very interested to hear your conclusions on making it run faster.

[Food for thought] Maybe when we are finished here, you'll have enough content to upload a "tutorial" video like you've done for the Hobbyist Servo motor. Seeing as stepper motors are more useful than servo's when it comes to multiple rotations, I'm sure a detailed tutorial would help bring more customers as well.
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Notification

Icon
Error