0

adafruit-vs1053
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: adafruit-vs1053

by roadshark on Fri Apr 06, 2018 1:26 am

Visited the links you sent me. At the moment the adafruit is out of stock with some of the items:( The bottom link https://www.globalindustrial.com/p/moto ... guide-rail Looks like it is what I am after. I will search around to see what I can find. I think I would prefer a square type of rail as the carriage would be less likely to move around from side to side though it really would not matter as it is only moving a plastic bug. I would attach a belt to the carriage (Is there an attachment that does this?)that would be driven by a stepper motor. I would need to run 5 motors and 5 servos per game (Plan to build 3 games) and was planning to use the mega with a Adafruit Motor/Stepper/Servo Shield for Arduino v2 Kit - v2.3
PRODUCT ID: 1438 It said in the spec sheet they are stackable but it would be expensive as I would need 3 shields to run 5 motors plus more for the servos. Not sure if the mega could handle all that power so would probably need to use transistors and separate power supply......

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

Re: adafruit-vs1053

by adafruit_support_bill on Fri Apr 06, 2018 6:13 am

There are lots of ways to attach the belt to the carriage. There are clamps designed for the purpose. But with a light load like that, a fender washer under a screw-head might be sufficient.

Driving 5 motors from stacked motor shields is going to limit your performance, since all the commands have to go over the i2c bus. You will get better performance for less money with 5 of the DRV8833: https://learn.adafruit.com/adafruit-drv ... kout-board

The downside of that is that you need 4 pins per motor. But if you are using a Mega, that should not be a problem.

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

Re: adafruit-vs1053

by roadshark on Fri Apr 06, 2018 10:53 pm

You are indeed a wealth of knowledge:) If I use the DRV8833 DC/Stepper Motor Driver Breakout Board as suggested from the specs it indicated I could drive 2 dc motors or one stepper motor. If this is the case, I would use 20 pins to run the motors. Also I have to run, I am assuming, 5 sevos to turn the bugs and 5 pins for the sensors of the bug being hit plus 1 sensor for restart button and I think you said if using a stepper motor I would need a sensor to find the home position? So it is adding up. I also want to use a music player. Is the mega going to supply enough pins???

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

Re: adafruit-vs1053

by roadshark on Sat Apr 07, 2018 5:59 am

Hi Bill,
Hope you are having/had a relaxing weekend. Here are the pics of the completed Jack-0-Lantern game. I have some poor quality vidoe but you can see the idea. Remember the aim of the game is to get the ball into a pumpkin. When first developed it was too hard so I had to modify some pumpkins and remove some pumpkins to make them into 'worm holes' to let the kids get some sort of score. I have never managed to get the boss pumpkin!:) https://youtu.be/_OlP580yqjk
Cheers.
Attachments
JACK O.jpg
JACK O.jpg (403.74 KiB) Viewed 1251 times

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

Re: adafruit-vs1053

by adafruit_support_bill on Sat Apr 07, 2018 7:37 am

Nice looking game there! Thanks for posting the photos and video.

Regarding your next game: The pins do start adding up with that many stepper motors. There are a few ways to extend the I/O capacity of your Mega:

An MCP23017 gives you an extra 16 GPIO pins accessible via 12c. https://www.adafruit.com/product/732
The i2c does add a bit of overhead, so you would want to use it for less time-critical stuff.

A Servo Shield would let you run all your servos from the i2c bus - freeing up a few more pins. https://www.adafruit.com/product/1411
Since you only have 5 servos to run, you could use the 11 spare channels as digital outputs.

Another approach that could potentially even simplify your coding a bit would be to have two processors. A 'master' processor would coordinate sensors and scoring and send motor commands to a 'slave' processor that just takes care of moving the motors.

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

Re: adafruit-vs1053

by roadshark on Sun Apr 08, 2018 3:41 am

Hi Bill,
THx for the advice but not sure how to use a slave?
As usual there are lots of ways to go. Anything that simplifies code is a bonus:) So would the slave processor be another mega or could I use a cheaper type? Also I have been using the music maker for music and sound effects for my games but could I use the wave player with the inbuilt amplifier instead? Also our Government in its infinite wisdom of squeezing dollars from its population are going to add 10% sales tax to all imported goods plus a $2 to $7 handling fee:( This will happen in July I think.) Plus I am not sure if Mr. Trumps import tarrifs on Chinese goods will affect the price of your electronic stuff! So keeping this in mind I intend to place a substantial order with you guys to get some stuff for my games.
Now for the bug whack game. What would you see as the best way to set the games up. Using one processor and expanding the pins or using a processor plus a slave? Obviously depending on which way I go will depend on the parts I need.
How would you set it up and what parts would you recommend. (What motors, servos, belts, pulleys etc) Wow! ( I will have to do overtime!)
At the moment I have the mega and speakers and a contact for the rails.
In terms of the game I intend to have the kids able to have two choices. To play as a Team or play against each other so I each game would need two displays to display scores as each player is at opposite ends of the game One button for reset/start game, 5 x Micro Switch w/Lever - 2 Terminal PRODUCT ID: 818 to attach to the bug to register the 'whack' 2 x 1.25" displays, 1 x music player, 5 x motors to move the carriages. 5 servos to turn the bug in the bug cave to return to home cave.
Had a look at your servo motors. It looks like I would need a servo that can turn 180 degrees and just build a mount to hold the switch with the bug on top.

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

Re: adafruit-vs1053

by adafruit_support_bill on Sun Apr 08, 2018 7:41 am

With multiple motors going at once, your motor control code will need to be responsive enough to keep them all stepping and not crashing into anything. Having a dedicated 'slave' processor to do that means that you don't have to worry so much about eliminating all possible delays or blocking conditions from the rest of your code. You could implement a simple command interface over a serial port so that your 'master' processor can send commands like "M2L50" (Motor 2 Left @ 50%). And you could build and test your slave subsystem independent from the master. Your motor control slave would need just enough pins for the motors, limit switches and a serial port to the master.

Using port expanders and such with a single processor is probably possible to do. But I can see the code getting pretty complex. If you do go that way, I would recommend using gearmotors instead of steppers. You would lose some of the positioning control, but it would require fewer pins and (more importantly) would have less critical timing requirements for the code.

Assuming the master-slave approach, you will need some DRV8833's and #324 stepper motors. Some GT2 timing belt and pulleys: https://www.adafruit.com/?q=gt2
And some more of the #818 or similar for limit switches.

Regarding the wave player: That is only compatible with the UNO. I think the Fx board might be a good choice for what you are doing. You can control it via trigger pins, or via a serial port: https://www.adafruit.com/product/2217

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

Re: adafruit-vs1053

by roadshark on Sun Apr 08, 2018 8:34 am

Looks like the slave is the way to go but it will be a leap forward in my education:) How many limit switches per rail? One on each end? So with 5 rails that would be 10 per game. I would need 1 DRV8833 for each stepper motor. So that would be 5 stepper motors. The motor have a 5mm shaft so what tooth pulley would you recommend? What processor would you recommend as a slave?

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

Re: adafruit-vs1053

by adafruit_support_bill on Sun Apr 08, 2018 8:51 am

With stepper motors, you really only need one limit switch for the 'home' position. From there you can count steps to know the position.

I'd probably go with the 36 tooth 5mm bore pulley. That will give you better speed with less overhead.

For the slave, you will need 4 pins per DRV8833 plus 1 more for the limit switch. With 5 motors that means 25 pins - plus another 2 for the serial port. That's more than you can get on an UNO. You could go with another Mega, or something like a Teensy 3.6: https://www.adafruit.com/product/3266

Another option is to use something like Pololu's MP6500 Stepper Motor Drivers. These just need 2 pins each (step and direction). So you could control 5 motors with 5 limit switches using just 15 pins.
https://www.pololu.com/product/2968

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

Re: adafruit-vs1053

by roadshark on Sun Apr 08, 2018 9:30 am

Would go with another mega for the slave. Now power requirements. I would need to power two megas, 5 motors, 5 sevos, two 1.5 displays, 1 fx board with built in 2w amp.
Here is the rail and carriage I am looking at from Aust.
Attachments
TRI (2).pdf
(229.03 KiB) Downloaded 37 times

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

Re: adafruit-vs1053

by adafruit_support_bill on Sun Apr 08, 2018 9:46 am

The motors and servos are the biggest consumers. The #324 motors would need 700mA @12v each for a total of 3.5A. This supply would do for that: https://www.adafruit.com/product/352

Assuming you are using micro servos, these will probably need need about 500mA @5v each for a total of 2.5A.

For the Fx w/amp I'd allow another 450mA @5v.
Not sure which displays you are using. Assuming the 7 segment type, that would be about 175mA per display. for another 350mA @5v.
Add a generous 100mA for the two Megas gives us 3400mA or 3.4A. This supply would handle that: https://www.adafruit.com/product/1466

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

Re: adafruit-vs1053

by roadshark on Sun Apr 08, 2018 6:05 pm

The first power supply is rated at 220 volts and australia is 240 volts would this be a problem. The 2nd power supply is ok. I would just have to change the figure 8 cord. The displays I plan to use are the 1.2 INCH 4 segment 4 digit displays.

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

Re: adafruit-vs1053

by adafruit_support_bill on Sun Apr 08, 2018 6:31 pm

The 12v supply will handle 240V ok:

Image

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

Re: adafruit-vs1053

by roadshark on Mon Apr 09, 2018 2:48 am

:) 5V 4A (4000mA) switching power supply - UL Listed
PRODUCT ID: 1466 According to the blurb on the specs page they do not recommend to run a mega with this. Instead they recommend using a 9 volt however it seems they do not have one to pump out 4 amps only 2!

Had a look at this Micro servo
PRODUCT ID: 169
Will this do the job? The other servo Standard PRODUCT ID: 155 was twice the price?
In terms of the drive system I would need two pulleys for each motor. One on the motor a drive pulley and an idler pulley on the other end?
Also in terms of speed, can the stepper motor be regulated through the software As I would like the bugs to be able to move at different speeds.
Because I intend to use a master and slave do I need
Adafruit 16-Channel 12-bit PWM/Servo Shield - I2C interface
PID: 1411

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

Re: adafruit-vs1053

by adafruit_support_bill on Mon Apr 09, 2018 6:30 am

Its not good for powering an Arduino thru the DC jack as it requires at least 7.5V - check out our 9V adapter instead!

If you power an Arduino via the DC jack, the power is routed through a 5v regulator which needs a couple of extra volts for stable regulation. If you have a regulated 5v supply (which this is) you can bypass the internal regulator and feed power via the USB port or directly to the 5v pin.

Had a look at this Micro servo
PRODUCT ID: 169
Will this do the job?

Yes. I think a micro servo should be plenty powerful enough for turning your bugs.
In terms of the drive system I would need two pulleys for each motor. One on the motor a drive pulley and an idler pulley on the other end?

Correct.
Also in terms of speed, can the stepper motor be regulated through the software As I would like the bugs to be able to move at different speeds.

Yes. You would probably want to use the AcccelStepper library since it supports running multiple motors simultaneously at different speeds.
Because I intend to use a master and slave do I need
Adafruit 16-Channel 12-bit PWM/Servo Shield - I2C interface

Not for master/slave communication. But you might want to use one for your servos.

For master/slave communication between two Megas, it is probably simplest to just use one of the additional hardware serial ports on each Mega. Connect Rx->Tx and Tx->Rx (as well as GND->GND) and you can easily send bytes back and forth using the Serial commands.
https://www.arduino.cc/reference/en/lan ... on/serial/

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

Please be positive and constructive with your questions and comments.