0

adafruit-vs1053
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: adafruit-vs1053

by adafruit_support_bill on Sun Apr 15, 2018 10:18 am

Yes. That would be a good next project to tackle.

adafruit_support_bill
 
Posts: 68551
Joined: Sat Feb 07, 2009 10:11 am

Re: adafruit-vs1053

by roadshark on Sun Apr 15, 2018 11:47 pm

Looks like I will have to dust off the old 'tackle' box:) I am afraid that when it comes to coding sometimes I come up with a concrete wall in my mind between what I can do and know and what I want to know and do. One of the main things I try to develop in children is 'persistence' so I always try and 'walk the talk' so I appreciate your patience with my questions and inquiries. It takes me a while to remove the wall one stone at a time:(
'BugStepper' state-machine around the AccelStepper.

Do you mean by this that I would use some of the AccelStepper commands incorporated within the BugStepper.
Would I create a class called BugStepper and basically follow the procedure as outlined in the sweep example in "multi tasking one". As a matter of interest are you and the author of this document one and the same?

roadshark
 
Posts: 391
Joined: Sun Nov 29, 2015 5:53 am

Re: adafruit-vs1053

by roadshark on Mon Apr 16, 2018 3:46 am

The motors etc have arrived!:) Extremely well packaged. A bonus is that the belt I ordered will fit exactly in the space without having to cut it! The board is 600mm wide. Allow for 20mm of indentation. This makes the bug whack zone 580mm. Space for the motor 55mm and idler pulley 50mm brings the length of the rail to 475mm. By the time the belt goes around the drive pulley and idler pulley it fits fine. I will put the idler pulley into a slotted hole so I can move it towards or away from the end of the rail to tension it.

roadshark
 
Posts: 391
Joined: Sun Nov 29, 2015 5:53 am

Re: adafruit-vs1053

by adafruit_support_bill on Mon Apr 16, 2018 7:45 am

One of the main things I try to develop in children is 'persistence' so I always try and 'walk the talk' so I appreciate your patience with my questions and inquiries. It takes me a while to remove the wall one stone at a time:(

Think of it as riding with a pack of fast riders. Just tuck in behind and follow the wheel. Holler if we go too fast. We'll try not to lose you. :)

Do you mean by this that I would use some of the AccelStepper commands incorporated within the BugStepper.
Would I create a class called BugStepper and basically follow the procedure as outlined in the sweep example in "multi tasking one". As a matter of interest are you and the author of this document one and the same?

Taking the last question first, yes, I am the author of that guide.

Now that my cover is blown, what we need to do with BugStepper and AccelStepper is similar to what we do with NeoPatterns and Neopixels in part 3 of that series. https://learn.adafruit.com/multi-taskin ... 3/overview

What we are going to do is to 'derive' a BugStepper class from the AccelStepper class. That means your BugStepper will 'inherit' all of the properties and capabilities of the AccelStepper. And you can add your own functionality on top of that.

In its simplest form, that looks like this:
Code: Select all | TOGGLE FULL SIZE
// BugStepper class - derived from the AccelStepper class
class BugStepper: public AccelStepper
{
    // Add additional state variables here
   
    // BugStepper constructor - calls the base class AccelStepper constructor
    BugStepper(uint8_t pin1, uint8_t pin2, uint8_t pin3, uint8_t pin4, bool enable=true)
    :AccelStepper(AccelStepper::FULL4WIRE, pin1, pin2, pin3, pin4, enable)
    {
        // Add additional initialization here
    }
   
    // Add additional functions here
}


That defines a BugStepper class that will do everything that AccelStepper does. The next step is to define what additional things we need our BugStepper to do.
Going through your description of the game so far, I think we'll need:
* Servo control for the bug.
* Automatic turn-around when it reaches the end.
* Automatic tuning of the bug when reversing direction.
* Full width runs and half-width runs. (case 4)
* Speed changes
I suspect we'll find more as we go along.

adafruit_support_bill
 
Posts: 68551
Joined: Sat Feb 07, 2009 10:11 am

Re: adafruit-vs1053

by roadshark on Mon Apr 16, 2018 10:12 am

:) I am pretty good at 'wheel sucking' and often have to pay the 'drafting tax' at the coffee shop!! Will read the link you sent tomorrow as it is midnight here!

roadshark
 
Posts: 391
Joined: Sun Nov 29, 2015 5:53 am

Re: adafruit-vs1053

by adafruit_support_bill on Mon Apr 16, 2018 3:11 pm

Your Jack-O-Lantern game made the blog today:
https://blog.adafruit.com/2018/04/16/fr ... tern-game/

adafruit_support_bill
 
Posts: 68551
Joined: Sat Feb 07, 2009 10:11 am

Re: adafruit-vs1053

by roadshark on Tue Apr 17, 2018 6:09 am

:) Went to look at a guys model railroad layout:) Reading all the info you have linked to and starting to work out how to fit the motor & start back at school tomorrow:)
The state variables for BugStepper would be speed/ direction/ steps?
Actually if the speed was set at 200, what would the centimeters/millimeters per second does that equate to using the pulley (36 tooth). What speed could this motor do?

roadshark
 
Posts: 391
Joined: Sun Nov 29, 2015 5:53 am

Re: adafruit-vs1053

by adafruit_support_bill on Tue Apr 17, 2018 6:28 am

The state variables for BugStepper would be speed/ direction/ steps?

The AccelStepper class already has a speed, so no need to replicate that. But you will need to track the direction so you can turn the bug and the number of steps (full run or half-run). You will also need to know the channel of the PWM/Servo shield for the associated bug-servo.

The units for the setSpeed function in AccelStepper is steps-per-second. The timing belts and pulleys are GT-2 profile with a 2mm pitch. And the #324 NEMA-17 motors are 200 steps per revolution. So with a speed of 200 steps per second, the motor will turn 1 revolution per second. Using a 36 tooth pulley that is 36 * 2mm = 72mm per second - or nearly 3 of the Queen's inches here in the USA.

adafruit_support_bill
 
Posts: 68551
Joined: Sat Feb 07, 2009 10:11 am

Re: adafruit-vs1053

by roadshark on Tue Apr 17, 2018 7:28 am

Mmmmm!!!!!!:( I do not think that is going to be fast enough:( The distance a bug needs to cover is 470mm. divide this by 72mm per second = 6 seconds for a bug to cross the bug whack zone. Any ideas......maybe I have to use a dc motor? I can get a 60 tooth pulley which should make the time around 3 seconds which would be ok for the slow bugs but not the fast ones.

roadshark
 
Posts: 391
Joined: Sun Nov 29, 2015 5:53 am

Re: adafruit-vs1053

by adafruit_support_bill on Tue Apr 17, 2018 8:16 am

You should be able to drive those motors faster than 200 steps/second. I've run them at more than 800 steps/second with the motor shield. A larger pulley would increase the speed also.

Your question prompted me to review the data sheet for the DRV8833 and I have to confess that I have steered you wrong with respect to power for the motors. We've been assuming a 12v supply for the motors, but the DRV8833 is only rated for up to 10.8v. There are a couple of things we could do there. 10v supplies exist, but they are not so common as 12v. Another option is to wire some diodes in series with the 12v supply to drop the voltage down to the 10.8v range.

I also took another look at your wiring diagram and noticed that you have 12v going to the Servo shield as well. Those micro servos won't tolerate much more than about 6v. You should power those from your 5v supply.

adafruit_support_bill
 
Posts: 68551
Joined: Sat Feb 07, 2009 10:11 am

Re: adafruit-vs1053

by roadshark on Tue Apr 17, 2018 8:31 am

Thx Bill.
I had a look in Australia and a 3d printing company do have a 60 tooth pulley however the 32 fits so nicely into the rail system I am developing I am hesitant about using the 60. Maybe I could use a 40 so there is a little bit of testing to do. Diodes would be the way to go here and I will fix up my wiring system. So do I just have to change the 200 into 800 to make the motor spin faster or is more complicated because this value resides in the AccelStepper library? I also thought another way to get around it, if I have to, would be to put more caves between the home cave and the other side and in the case of the fast bug to move the caves closer together only allowing a small space to 'whack' the bugs!
I was looking at the micro servo. Do they make an extension to go on the drive shaft to lengthen it as I need to develop the shaft to go through the routed board hole track to hold the bug switch and bug?
Would the voltage drop to the actual motors to 10 volts be negligible in relation to performance?

roadshark
 
Posts: 391
Joined: Sun Nov 29, 2015 5:53 am

Re: adafruit-vs1053

by adafruit_support_bill on Tue Apr 17, 2018 8:56 am

So do I just have to change the 200 into 800 to make the motor spin faster

Yes. Just sent 800 to the AccelStepper setSpeed() command.
I was looking at the micro servo. Do they make an extension to go on the drive shaft to lengthen it as I need to develop the shaft to go through the routed board hole track to hold the bug switch and bug?

I've seen those for regular servos, but not for micro servos. There is some danger in extending the shaft on any servo since it creates a larger moment arm for radial loads. When a student whacks the bug at the end of an extended shaft, that will put a lot of stress on the base of the shaft. Those servos have plastic shafts and geartrains that won't hold up to much stress. One solution is to support the bug and the shaft with some sturdy bearings. Then attach the servo to the bottom of the shaft so it is not subject to any direct stress from the whacks. I've had good results using a short length of rubber tubing as a 'flex-coupler' in such applications.
Would the voltage drop to the actual motors to 10 volts be negligible in relation to performance?

A couple of 1N4001 diodes in series between the power supply and each DRV8833 would drop the voltage about 1.2v which would put you right at 10.8v. That will give you about 10% less torque than you would have at 12v and most likely a slightly lower top-speed.

adafruit_support_bill
 
Posts: 68551
Joined: Sat Feb 07, 2009 10:11 am

Re: adafruit-vs1053

by roadshark on Tue Apr 17, 2018 9:25 am

Thx for the tip. I have a round disc of acylic plastic that I was going to attach the four arms of the servo to then run a transfer shaft from this to the servo. So basically I need to come up with something that will transfer the force of the whack to somewhere else not the servo shaft. Mmmmm. What about some springs under the bug? Or some sort of wheel design on the turntable itself? Perhaps the coupler I use from the disc to the servo shaft has some up and down movement? Not sure what you meant by bearings and where? I like the idea of the flexible rubber coupling but it would need to support the bug etc as it shoots across the whack zone. What ever it is I want to K.I.S.S, as always.:) Well try at least.

roadshark
 
Posts: 391
Joined: Sun Nov 29, 2015 5:53 am

Re: adafruit-vs1053

by adafruit_support_bill on Tue Apr 17, 2018 9:36 am

These are the "Servo Blocks"they make for 'standard' size servos. Way too expensive and overkill for this application. But the general idea is that the extension shaft is supported by a ball-bearing mounted to the frame and the servo attaches to the back of the frame. Since all the axial and radial stress is handled by the bearing, the servo shaft connection only has to be concerned with torque. https://www.servocity.com/637110

Not sure how you plan to mount the servos, bugs and switches to the carriage. Do you have a sketch of what you have in mind?

adafruit_support_bill
 
Posts: 68551
Joined: Sat Feb 07, 2009 10:11 am

Re: adafruit-vs1053

by roadshark on Wed Apr 18, 2018 4:46 am

What a nice piece of engineering. As I am thinking of mounting the bug directly to the switch I think a lot of impact will be absorbed by the switch itself. The mallet itself will be of soft foam. Here is something I am thinking about. The collar fixed to the bug will need to be able to move up and down on the shaft yet still mesh with the drive shaft fixed to the collar on the servo drive shaft.
Attachments
MECH 1.jpg
MECH 1.jpg (24.2 KiB) Viewed 462 times

roadshark
 
Posts: 391
Joined: Sun Nov 29, 2015 5:53 am

Please be positive and constructive with your questions and comments.