This video uses the exact same hardware setup as Part II, but this time instead of using the Prox sensors for input, we are going to use one of the new Encoders from Automationdirect – these feature inch sizes, optional military connectors, Light, Medium and Heavy Duty service models, an IP-65 rating for water resistance, and range of 100 to 2500 pulses per revolution.
The Military style cable can even be used with the Marathon motors that have built-in encoders!
This encoder is wired to the P3 Remote Base like this.
After the encoder demo, we’ll do a demo where we do both the prox sensors AND the encoder at the same time! Here we go …
Here’s the hardware configuration of the HSI module. We’ve added the encoder inputs on channel 1A, 1B, and 1Z.
We still have our Prox sensors setup on channel 2 and I simply copied most of those setting over here to Channel 1. We’ll name this the “Encoder Channel” and we’ll use our custom units again.
Now, here’s the trick. Since everything we did in the previous video was in the custom units of “Teeth” all we have to do here is modify the number of counts that give me one tooth. Since we are using a 360 count per revolution encoder, and we have a 36 tooth sprocket, well, that’s 10 encoder pulses per tooth so we just put a 10 right here.
Let me move this up so you can see it.
We need to make sure we specify Quadrature encoder here. If we choose the quadrature times 4 option, then we would simply change this to 40 counts per tooth.
Now I know the way I have this setup wired the encoder will give me a backwards count relative to the prox sensors, so I’m going to go ahead and invert the polarity here. And finally, on BOTH channels, I’m going to select this option – use the Z-Input to reset the count to zero. So every rotation of the sprocket will reset our tooth count to zero. I’ve done that on both channels.
So that’s it – it’s the exact same settings we had in the previous demo except we modified our custom unites to be 10 counts per tooth to account for the encoder, gave the encoder tags a slightly different name, selected a quadrature encoder times 1, And now we are using the Z input to reset the tooth count.
Select OK. We are done configuring the HSI module.
So understand the beauty of using those custom units. Since all of our ladder code was using Teeth, all we had to do for the encoder was modify that custom unit to be driven by 10 pulses. None of our ladder code needs to change now since it is expecting a tooth count. Now in our example here, where our ladder code was just one instruction, it’s no big deal. But in a larger project, that’s a huge time savings for you
So this is the registration instruction we had in the previous demo for the prox sensors. I simply copied that and created a second instruction. Instead of the prox channel we are using the encoder channel now. Which is channel 1 on the HSI. And added an “enc” for encoder for these status tags.
Under Trigger group 1 we want to trigger off of the encoder Z-Pulse now instead of the prox like we had before. We are going to delay the registration action by some delay – I’ve created a new tag for that. And after that delay we are going to pulse our strobe on output 1 instead of output 2, again for 1 millisecond. We’ll say OK.
Down here I’ve created a data view so we can keep an eye on some of those tags.
Let’s see, we’ve made a bunch of changes, let’s download that to the controller. And we are ready to go.
I’m going to reach down to the controller and enable both of these instructions by flipping this switch on the input simulator. Note that I changed the options to give me a block cursor instead of the lines. Both instructions are showing me that they are ready to go.
Let me go ahead and push the proximity sensor delay back out to 24 like we had before.
And we’ll leave the encoder delay at 20. Here are my Sprocket Counts and here are my Tooth Counts.
I’m just going to reach over with my hand and rotate the sprocket some so we can see what is happening. I can see my sprocket rotations are counting and I can see my tooth count when it hits 36 resets back to zero. Perfect. I’m going to change the tooth delay on this encoder to 15 to bring the smiley face around where I can see it.
Now when we run the demo we see that we get the exact same result, except this time it is the encoder Z pulse that we are using for an index and encoder pulses that we are using to count teeth. And just like before, if I change the delay and write that out, we see the smiley face jump.
Since we still have the Proximity sensor example running, can we see that? Sure! Remember, the prox example used a green strobe and the Encoders used the white strobe. If I change the tooth delay on the prox sensor – I’m going to move it forward two teeth – and now we can see both the white and the green smiley face.
Where is the index located on the Encoder? If we set the delay to 1 (you can’t have a delay of zero here) we see the smiley face way down here. So we know the Z index is one tooth before that!
How fast are these teeth moving?
We’ll, we have a motor that can run at 1725 rpm, if we convert that to revs per second and multiply that by the 36 teeth we have per revolution, we get roughly 1000 teeth per second going by – that’s about one tooth every msec. And remember – our strobe pulse width was 1 msec – right? So while that strobe light is on, a tooth will travel a little over one position during the strobe pulse duration when the motor is at full speed. Can we see that? Sure!
Let’s crank up the motor speed to 1725, bring up a strobe light - and sure enough we can see the blur of the tooth sweeping through 1msec of time or about 1 tooth width! That’s pretty cool.
Now I realize you probably won’t be doing things in one msec time intervals in your projects, but this does highlight just how capable the HSI card is.
And remember – while all of this registration and counting stuff is going on, on both channels at the same time, the main CPU in the base is un-burdened with any of this. This one registration instruction takes care of all of the work - as long as it is triggered with a rising edge and then left enabled.
Let me show you one more thing: The example we just did used two different registration instructions triggering off of different strobes. Could we have done all of that with ONE registration instruction? YES.
Back in the Registration Instruction for the Proximity Sensor … we told it to pulse the LED after a delay after the rising edge of the index pulse of the proximity sensor.
We’ll look here – there is second trigger group! We could have simply said trigger on the other input, the encoder input in this case – save it to some event count - after some other delay - pulse our other output for 1 millisecond.
So with TWO independent trigger groups, you can actually do two different registrations with ONE instruction!
Well, that should be enough to get you started, but know that this HSI module has a number of other options we didn’t cover here that make this unit even more flexible and more powerful, yet still easy to use.
Be sure to check out the other videos in this series for more ways to get up and running quickly with the Productivity3000 system. And as always, please send us any comments you may have, we really appreciate the feedback.
Performance plus Value … That's Productivity.