SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By nineball
#113997
This will be my first project and I thought I would jump in head first. I am planning on building a mobile for my unborn baby (due mid-February) and would like to incorporate music, motor control and possibly lighting. As with everything else I do, I want to go big, so I will be building a full blown audio player (not fully controllable however) drawing my inspiration from the MP3 Belt Buckle tutorial. Based on pricing and technology available (nearly 2 years later), these are the main parts I am looking at currently:
  • NXP LPC1758 Cortex-M3 - the brains
  • VLSI vs1053b - decode music files and output audio
  • STMicroelectronics L298N - drive motor (Tamiya 6-speed gearset kit)
  • SD/MMC slot - memory for files
  • USB miniB connector - file upload and programming
  • 3.3v, 2.8v, 1.8v regulators - for various ICs
As it stands, I plan on using the LPC's built-in SSP0 for all SPI commands (SD, vs1053b), USB pins for that interface, MCPWM for controlling the motor bridge, UART0 for programming and various GPIOs where needed. There will be a master on/off switch with a reset button for programming on the back and a large button on the front for the baby that will play songs randomly from the SD card and drive the motor for a specific amount of time (15 or 30 minutes is what I'm planning). Repeated presses of the button will skip to the next song within the time frame. I am also thinking of using potentiometers for volume control and manual motor control. It will be powered with a plug-in wall-wart so that I don't have to worry about batteries and charging them.

I have already begun work on the schematic but will probably have blown some of it and even though it is not yet complete I'm sure there will have been things I'm not even thinking of due to inexperience. Any and all help will be very useful, especially on my somewhat tight schedule.

ImageImage
By nineball
#114551
A slight bump and update. I have now added a circuit for the 3.3v regulation (same as the other 2) as well as decoupling caps on the M3's VDD pins and a momentary reset switch (taken from the beginning electronics tutorial).

For the speaker, I plan on using this one. I am not clear on if I will be able to drive it directly from the Left and Right pins in my schematic however. I originally looked at the STA540 but it looks like that would be overkill (~10w @ 12vin versus the speakers 0.5w). My question would be, will the M3 drive the speaker as is and will that speaker provide music loud enough for my child to hear from ~1-2 feet.

For the motor, I believe I understand how it works but could use some confirmation as I am doubting the more I go over the datasheets. Would I use the M3's MCOA0 and MCOB0 pins for the 2 inputs on Bridge A and the Sense A output pin to MCI0 while tying the Bridge A enable to 3.3v through a switch? I'm also unsure of how I would adjust motor speed with a potentiometer. Also, it looks like I will also need to add 5v regulation for the L298N logic in addition to the ~12v I plan on using for motor supply.

Any input is appreciated, thanks.
By frank26080115
#114590
This Sounds advanced for a "first" project. I've easily gotten a full blown MP3 player working on SparkFun's VS1033D breakout boards along with an ATmega644P (which is much weaker than your Cortex M3). Are you sure you need that much processing power? Do you have the development tools for it?

You can't get decent volume from any speaker that is connected to those MP3 decoders, I've tried. You need some sort of amp.

USB can get complicated if you are starting out from scratch, do you have existing code that will let you transfer files between the computer and the LPC?

It also looks like you are planning on making a PCB, that's going to take some time and experience.

My advice for getting this project done fast is this:
Use breakout boards for everything (MP3 decoder, microcontroller that you are familiar with, motor controller, SparkFun has all of these)
Buy a decent speaker, one that is powered externally, this will save you effort on making an amp that connects to your MP3 decoder
Forget about USB unless you are sure you have the code for it, use standard sized SD cards instead of microSD, and just use a card reader instead. If you want it to be wall powered, you would not want to always move your toy to a computer anyways.
For motor speed control from potentiometer: potentiometer gets turned into a voltage divider, microcontroller reads in voltage using ADC, and outputs appropriate PWM signal to motor controller to adjust motor speed. I don't know much about the LPC and its pins but you do connect where you output PWM to the L298's "enable" pin, but I know that Solarbotics sells a L298 board that is very easy to use (built-in voltage regulator, LED indicators, very nice).
User avatar
By thebecwar
#114591
My thoughts:

-USB is tricky but not impossible. If you're hard set on using USB I'd highly recommend an integrated USB host/device controller, and that you pick up a copy of USB Complete by Jan Axelson. It's a good reference to the crazyness involved with USB.

-Depending on your startup costs, and what equipment you have available, working with an evaluation kit may be a better option. Off the top of my head I am having trouble thinking of any that do everything you want, but the EVK1105 from Atmel may get you headed in the right direction. (AVR32 does require some knowledge of C/C++ and some extra startup money for programmers.)

-Depending on your knowledge level, and how comfortable you are with C/C++ and hardware you may want to head away from a solution where you have to create everything yourself. Of course, if your goal is to learn, use the technologies you want to learn.
#114612
Thanks for the input guys. I'll try to tackle your questions/input as well as I can. I know it is advanced for a start, but it's really the specifics to microcontroller and IC work that I need to get as I read datasheets/tech docs and program all day long to interact with hardware at work. As for my choice in uC, the Cortex-M3 is similar enough the ARM7 that I felt comfortable using it while still using the Belt Buckle MP3 project as my baseline and the cost is only a few dollars more than an AVR so going forward I will already be familiar with the new and powerful for any other projects I decide to work on (although I understand they both have their places).

USB/Programming - I plan on using the FT232RL Breakout Board with the Flash Magic programming tool as described here to do the initial ISP bootloader software upload (which will be reusable for other projects) and then use IAP afterwards through the USB port. As for the USB software programming part, I will use the Belt Buckle MP3 project as my starting point since I am using a similar part (my NXP Cortex-M3 versus his NXP ARM7). Software will all be done with the WinARM toolchain and OpenOCD if I ever implement JTAG. I do plan on using standard SD cards and have been leaving that consideration for loading the music in my case design. My main PC is a laptop so mobility isn't an issue either way.

Breakout boards - I thought about this but was concerned about space requirements in addition to the fact that the ARM chips don't have breakout boards anyway. There is also the cost factor which I am trying to keep down and breakouts are far more expensive than their individual parts.

PWM/Potentiometer - Thanks for pointing me in that direction. I will look more into using the potentiometer/ADC combo for controlling the MCPWM output. Actually, I guess I could just use a normal PWM instead of the MCPWM and then I would tie PWM output to Bridge A enable. The Bridge A inputs could then be tied high on one and low on the other since I don't care if it always goes in the same direction.

Speaker - Any recommend amp setup for the speaker since it is required? I was looking at the STA540 as mentioned but it seems like overkill and the LM358 is not enough by the comments. I also could not find the LM386 mentioned there anywhere.

PCB Fab - Once the schematic is finished I will use Eagle to create the board and farm out that work to BatchPCB or another fab. I can consult one of the hardware engineers I work with for advice here since he does this all day. Maybe I could even make use of our fab partner.

Eval Kits - Too expensive for this project. And as you pointed out, this will be a great learning experience. If I had more time/money for this project I would probably do this and the above mentioned breakouts for prototyping then design a product from there. In a perfect world...

As always, more help is always appreciated!
By nineball
#114628
That looks amazing (especially at that price) for prototyping with the NXP chips; I'd only want an inexpensive programmer/breakout board like that and not an expensive full eval board like a Keil. I'd absolutely get it if it was available but the only ones they currently make are for the LPC1114 and LPC1343 controllers. When they end up coming out with one for the LPC1758 I'll snap it up in a heartbeat. At that point I'll have a USB/UART and a USB/JTAG for future projects even in addition to the handy breakout.

[Edit] I just checked out the Embedded Artists site and saw the LPC1768 model they have which I could not find elsewhere. Looks like they are expecting stock again on Dec. 22 so maybe I will wait and pick that up. Looks like ~$38.25 CAD with First Class mail from Sweden or ~$55.70 CAD with UPS Express Saver.
#115434
I recommend looking at microbuilder.eu 's LPC1343 codebase, it has a a lot of drivers and FAT fs things. I have interfaced their fatFS to an SD card pretty easily. You'll have to make some makefile changes to get it too 1758 but since it's also cortex M3 so shouldn't be too bad. Also I suggest taking a look at the 1768 it seems to be a similar price point but has better features. I am not sure how similar the 1768 and 58 are but here is a good example schematics for the board: http://blueboard-lpc1768.googlecode.com ... matics.pdf (from ngx technology's dev board--good price). also a lot of AVR/arduino nerds seem to be intimidated by arm, and don't really know the distinction between the various types, so don't worry it's not as incredibly complex as they would make it seem.
By nineball
#115648
Don't worry about the intimidation factor, the AVR/Arduino guys might have more support; but I'd rather build with what I consider the best, I always do.

I have switched my design to LPC1768 (LQFP100 for hand-soldering does slightly intimidate me though) to match the protoboard which only costs a couple dollars more than the LPC1758 and am now considering adding in ethernet support. I won't bother coding it in at first kick, but the hardware will be there for future firmware. Any recommended PHYs?

PS. I also plan on updating the schematic over the weekend to get any more feedback.
#115684
nineball wrote:Don't worry about the intimidation factor, the AVR/Arduino guys might have more support; but I'd rather build with what I consider the best, I always do.

I have switched my design to LPC1768 (LQFP100 for hand-soldering does slightly intimidate me though) to match the protoboard which only costs a couple dollars more than the LPC1758 and am now considering adding in ethernet support. I won't bother coding it in at first kick, but the hardware will be there for future firmware. Any recommended PHYs?

PS. I also plan on updating the schematic over the weekend to get any more feedback.
No recommendation, not using ethernet in my project.
#115694
Between what Mouser stocks and the chip on the Code Red development board (so it should integrate well) I have chosen the SMSC LAN8710A as my PHY. Between it, the 25MHz crystal it requires and the MagJack connector, I'm looking at adding only ~$4 to my BOM which is acceptable to me for future-proofing my hardware design. It even features both MII and RMII so I can play with both (the LAN8720A Code Red uses is RMII only). The only downside is that all my other SMD chips are now going to be on breakout boards for prototyping initially and this one won't be. Any one know of a generic 5x5mm 32-pin QFN breakout board?
By nineball
#116596
Quick update. Just got my proto board from Embedded Artists and it actually has a LPC1769 instead of the LPC1768. According to a note I got with my package this is how they will all be shipped going forward. Same pin-out though so no problems and I can now go up to 120Mhz (although I have no intention of even hitting 100). Also, I have since realized why Code Red went with the LAN8720A and have switched my design to that. Unfortunately, I could not find an Eagle file for this so I am in the process of creating my own. A verified part would probably be better though so if anyone knows of one, please post a link.
#116666
nineball wrote:Quick update. Just got my proto board from Embedded Artists and it actually has a LPC1769 instead of the LPC1768. According to a note I got with my package this is how they will all be shipped going forward. Same pin-out though so no problems and I can now go up to 120Mhz (although I have no intention of even hitting 100). Also, I have since realized why Code Red went with the LAN8720A and have switched my design to that. Unfortunately, I could not find an Eagle file for this so I am in the process of creating my own. A verified part would probably be better though so if anyone knows of one, please post a link.
I remember LPC announcing eagle files on their twitter, I would check on their website.