Help on getting started...

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
xl97
 
Posts: 201
Joined: Mon Jul 27, 2009 12:51 pm

Help on getting started...

Post by xl97 »

Im sure this may have been asked before.. so forgive me if Im beating a dead horse here.. (Im now to the site, first post..so if there is a sticky or something..please let me know)

I have decided I would like to get into programming my own microcontroller, and I guess I have a fairly ambitious 'end goal' in mind.. (sound board and PWM supported LED driver board in one unit).. all controlled my one 'brain' so to speak..

I have no clue of going the PIC or the AVR route.. and not even sure WHY I would choose on over the other..

I have read a little about the Arduino boards.. and really the nano seems to be the only one that would be small enough to even use.. (end goal PCB will need to be about 1.0" x 2.5" max I would think.)

and just dont know enough if it would even suit my needs..but the price for each 'nano' seems to make it not a viable solution as is..

I have a PICKIT2 programmer..and have 'flashed' PIC24 chips before..but using pre-exisiting firmware/hex files never any 'coding' myself of firmware or embedded API's..

ideally what I would like to explore doing, is to duplicate the sort fo thign that was done at the Replicant FX project

www.replicantfx.com

http://www.replicantfx.com/FXOrion.html

Documentation:
http://www.replicantfx.com/files/FX_Orion_Jan09.pdf

its basically a chip..that comes pre-flashed with an API that the end user can use to write/create their OWN custom programs/configurations to suit their needs..

I really like this 'idea' of an instruction set that the end user can make use of..
That specific project uses the 28 pin PIC24 chip..

however.. the project is sorta dead at the moment..and I thought it was a GREAT idea without being 'too' overboard or out of reach really..

I would like to pursue a path on learning HOW to do this exact same thing...
however it current only has FAT16 support for the SD card.. where as FAT32 would be desired.. dual 8-bit sound support instead of desired 16-bit sound support... (it also had a few bugs that were never fixed before the project support ended)

Im not sure if room would be a factor and a new chip would need to be used? or where to even begin on this?

if that is too ambitious.. Id like to learn how to make a more static version, where the code is embedded on the chip..

1.) play embedded sound when turned on
2.) play embedded sound when turned off
3.) play continuous looping sound while board is on
4.) 1 analog sensor that plays sound A over #3 when circuit/connection is made
5.) 1 analog sensor that plays sound B over #3 when circuit/connection is made
6.) has to have PWM control/support.. so it can fade in/out a MAIN HIGH POWERED LED..


there are other things....but I believe these to be more hardware/PCB related (like the voltage and current control/regulation/output..etc)

anyways.. any ideas on where to start.. links websites preferred..but book links appreciated as well..

Thanks

John_NY
 
Posts: 55
Joined: Sun Jul 05, 2009 2:54 am

Re: Help on getting started...

Post by John_NY »

I'll take a look at this in my free time and see what comes of it.
My first bit of questionable advice: I have heard that the Arduino nano board is less friendly for developing than the regular Arduino. If you expect to build up to this project, starting with a bigger and friendlier board might be good while working out the bugs, and the AVR language should be fairly portable, save for a few details such as where you connect your digital/analog pins. Also, you can connect "shields" that could help with development before you build something smaller and single-purpose.
I myself am starting out with Arduino/AVR as a hobbyist, and I've not played around with a wave shield that could help with developing the final board you build.
my 2¢,
-John

User avatar
xl97
 
Posts: 201
Joined: Mon Jul 27, 2009 12:51 pm

Re: Help on getting started...

Post by xl97 »

Thanks.. I appreciate any replies... Im just starting in this world of micro controllers.. I do have alittle bit of a programming background in other languages..so Im hoping the transition wont be 'too' bad.. as over all programming concepts are NOT un-familiar.. but using anything with a micro controller is..

I will probably stay 'away' from anything Adruino base for now..if for nothing else..the cost.. if I started on a bigger one.. in the end the NANO would be the only size (not sure the size of the mini..or the difference between the two really) in the end that would work.. cant be bigger than 1.0" x 2.5"

What would be the difference between PIC and AVR? not what is better (per se`) I read the article here.. but not sure why one would choose one over the other I guess?

In the end.. I will need to design (or get help with) a PCB layout.. and other hardware requirements to handle power input..on-board sound amplifier.. etc.. (sound board and led driver board in one unit)..

however I need to start at the 'brain' and build something that I can throw in a bread board project for testing.. each piece.

so Im starting with just learning how to not only physically program the chip...but also learning about the language side of it as well.. (making a HEX file to flash to the chip for example)..

like I said I have a PCKIT2 programmer.. so Im hoping I can still use that in the end.. but I have only flashed OTHER people
s HEX file to my chips to be used..

I would LOVE to do something similar (and more stable) than the Replicant FX project linked to above.. (man I really dig that approach/project)...

but will settle for doing things an embedded way and having it all work on-board the chip.. no options or customizable options to the end user..

thanks

John_NY
 
Posts: 55
Joined: Sun Jul 05, 2009 2:54 am

Re: Help on getting started...

Post by John_NY »

xl97 wrote:What would be the difference between PIC and AVR? not what is better (per se`) I read the article here.. but not sure why one would choose one over the other I guess?
Regarding PIC vs. AVR: I spotted this link on this site, and there are also some links there to the various other forums and such for microcontrollers (e.g. PIClist).
xl97 wrote:anyways.. any ideas on where to start.. links websites preferred..but book links appreciated as well..
"Ideas to start" look like the bottom line, where AVR-specific information would be avoided in favor of PIC.
I think folks would have a good idea of what you're planning once they read this thread, but to help you, would need to know where you are starting from as an electrical engineer (does this process look familiar and intuitive?).
So who are you? :)
-John

update 7/28: I spotted this well-documented request on the Microcontroller forum, and noticed that nobody was able to venture an answer.
It's probably safe to venture that these forums are not the best place to get an answer about PIC controllers. Knowledge of microcontrollers seems to be AVR-based (though there is at least one fan of Cypress devices).

User avatar
xl97
 
Posts: 201
Joined: Mon Jul 27, 2009 12:51 pm

Re: Help on getting started...

Post by xl97 »

Hi John-

well Im no EE by any means.. just a DIY sorta guy..

that wants to learn how to MAKE my own stuff..instead of soldering up other peoples 'inventions'.. :)

I have flashed PICs before, using other peoples HEX files... and can solder 'decent'.. no SMD components or anything.. just regular iron.. :)

I guess I just need some advice on where to start..

Like where can I learn about the differences in chips even?

difference between PIC16/18/24 and 32's?

First Id need to find a chip that will suit my needs I suppose...yes?

I dont know if all chips have hardwired pins?..or if this is just something you code for in your firmware? Like for PWM pins? ADC (Analog to Digital pins)? Sound pins? SD card pins?

as in this diagram:
http://www.replicantfx.com/FXOrion.html

are these pins like that because of the chip he uses/chose? of this depicted in the firmware making these pins have certain functions?

From that point..

I guess I would need to learn how to write/program/code to make the chip do what I need to do..

(minimizing the learning curve and the time/process/difficulty of course here) LOL

my next question would be...

using the www.replicantfx.com open source project as a base again..

Im assuming it would be EASIER to make some firmware and embed it to do what I need.. (very static options to the end user of the chip).. compared to making a 'sub-language' that the end user can use to write their own programs on the chip..
(ie: like the replicantfx.com project does).. correct?

I dont even know what type of book to buy.. I dont wanna throw my money away on something that is beyond me....not relevant to what I want to do.. or outdated.

Is there a forum that embraces the PIC vs the AVR? if this 'isnt' the place to be?

Thanks

John_NY
 
Posts: 55
Joined: Sun Jul 05, 2009 2:54 am

Re: Help on getting started...

Post by John_NY »

I <link>dotted</link> my earlier post with <link>links</link>, e.g. <link>PicList</link>.

It sounds like <link>starting with your size constraint</link> is good practice, but that applies for folks who are familiar with the wide range of tools at their disposal.
Some sites include <link>www.sparkfun.com</link>, and someone on these forums linked to <link>www.futurlec.com</link> (I have not used either).

There's also a <link>good thread</link> about designing a system with a computer/microcontroller.
Sorceress Sarah wrote:Step 1: Define the problem
Step 2: Define the inputs
Step 3: Define the required outputs
Step 4: Define the process to get from inputs to outputs
Step 5: Create suitable circuit
Step 6: Write code

You can use this template for any design problem.
Okay, so I am a a few steps below a total amateur when it comes to designing circuits (my experience with arduino includes blinky lights and a refrigerator temperature sensor). But here goes my attempt at following the above procedure for circuit design.
(1) There is a need for a <1" x 2.5" device capable of playing sounds and illuminating high-powered LED.
1.) play embedded sound when turned on
2.) play embedded sound when turned off
3.) play continuous looping sound while board is on
4.) 1 analog sensor that plays sound A over #3 when circuit/connection is made
5.) 1 analog sensor that plays sound B over #3 when circuit/connection is made
6.) has to have PWM control/support.. so it can fade in/out a MAIN HIGH POWERED LED..
(2) Inputs are on-switch, off-button/request to turn off, loop, button 1, button 2 (you say buttons 1 and 2 are analog sensors, but you talk about "connections" which makes me think it'd be just as good as a digital input).
(3) Outputs are high-powered LED with PWM, speaker capable of loud volume and somewhat faithful sound reproduction or of tone-generation. You'll need a small, loud speaker and perhaps a 3V (2 batteries) or 4.5V (3 batteries) power supply.
(4) To get from input to output: The PWM will probably drive a transistor that controls the LED. When the LED fades in and out will determine how you write the code. The PWM is probably controlled from a digital output pin, since it is pulsed. Can the sound be driven from the chip? Probably not at great volume. You'll need another transistor and a piezo speaker, I speculate. To code the sounds on a chip, you possibly want to convert a very short wav file into an array. Do research on making noise with your circuits. The "wave shield" writeup indicates that playing properly buffered audio might be problematic, so would a tone generator be enough? Alternately, are there any mp3/sound modules that could be connected to your small device by a long pair of wires or a ribbon, and stashed elsewhere in your device? You probably want either a tone-generator or a modular solution since you and I lack the background to construct our own. Alternately, you could look up existing sound circuits until you find one you like. Are there already Integrated Circuits that contain the bulk of what you want to do with embedded/embeddable sounds? Is there an I2C (two-wire) solution? The I2C solution might be triggered by the controller and do all the hard work of creating/reproducing the sounds by itself.
(5) Based on these things, you might start building a circuit. Hooking up an analog transistor circuit is fun, and if you have not done it before I'd be happy to submit a simple circuit that might help with the eventual LED/Speaker design (though you'd get better designs online, perhaps). The wav file player or tone generator might end up taking the bulk of your research before you find a good solution.
(6) The code will be PIC-specific, so I'll leave it to you to research the libraries available (google?).

So there's my amateur opinion: identify the basic building blocks, and figure out whether they exist or can be made, do lots of research, revise your design based on available materials and technology. Break down your project into testable modules that you can build or buy and test to ensure they can do what you want them to do. Once you do that, if you sketch a simple circuit or connection diagram on paper or in Visio or any vector drawing program and post it, it'd be interesting to see.
-John

ps -- books are good, and lots of folks have recommendations. Search the forums for some suggestions about favorite books. I'll post the name of my college text if I find it.
pps -- also, if you do not do this already, buy a graph-ruled laboratory notebook and use it when you are experimenting with your modules, circuits and experiments.

User avatar
xl97
 
Posts: 201
Joined: Mon Jul 27, 2009 12:51 pm

Re: Help on getting started...

Post by xl97 »

thanks for the reply..

Im too concerned with the hardware side of things.. the LED drvier board/components will support PWM.. so I just need to code the PWM routine to 'pulse' out the LED driver board..

as for sound..there would be an on-board 'amp' to solder a speaker to.. (currently I just use a audio aplifier I got from RadioShack with a leads going to a bread board.

it will play/use .wav files.. (like the current ReplicantFX and others make use of)..

I guess I just need to find my direction on where/how to start programming for the PIC24...

I wet to Borders at lunch.. it was a 'bust'..they had 1 book..and it was ADVANCED Programming of Microcontrollers for 8-bit or something I think..

not a beginner book I was hoping for..LOL

I have a 'buddy' who is fairly good at the hardware aspect of input/output voltage and PCB layouts...etc

however "I'd" be in charge of the brain so to speak.. creating an program to flash the chip with that can control these components and outputs..as well as input tracking (interrupts?) and doing 'something' whenever an input is received form one of these senors..

re: sensors.. they are analog.. I mean connection, as in when the circuit completes in one of theme ball or nail/spring type analog sensors.

Thanks

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”