PIC control board PCB

To give you a very dirty idea of where this board fits in the scheme of things…
A generic ranking:
(1)Modern PC
(2)Gumstix/ARM7 microcontroller
(3)dsPIC (there’s one on this board)
(4)PIC18F (there’s one on this board) *
(5)PIC16F **
(6)PIC12F

*The ATOM PRO is one of these.
**The ATOM and STAMP are examples of these.

Modern PC’s, and very very advanced micros, like the ARM7 use 32-bit architecture.
dsPIC use 16-bit architecture.
18F and below uses 8-bit architecture.

How many bits you’ve got determines the overall precision of your micro, as well as a few other nice things.
For instance, 32-bit micro can hold a decimal number of up to 4.3 billion in a single assembly instruction.

So, the dsPIC on the board is very respectable.
I wouldn’t use it for complicated audio/video processing, but it can certaintly keep up with just about any other task you throw at it.

Even the 18F micro is very respectable, and it’d be a very noticeable improvement over the STAMP that you’ve been using.

Yup.
It’s just a very nice breakout board for two microcontrollers.

The neat of this board is not that it’s got one fast micro.
Other boards have that feature
The neatest part is being able to do true multitasking, as there are now two processors.
So, if you need to keep very accurate timing of two operations (which is very hard to do with one micro) you can have the dsPIC time one and the 18F seperately time the other.

Certaintly not.
Controlling this beastie with an ABB or any other similar micro seems rather silly.

Can you give me a few examples of its use to help me understand its potential?
Sure…
One use:
Do anything you’re already doing with your STAMP, but do it 12X faster.
:stuck_out_tongue:

What I’ll be doing with it:
Using 13 regular I/O pins to control a seperate dual-channel speed controller that I’m building.
4 of those pins need to be turned on and off at very exact rates or the speed controller will short out and die.
1 ADC pin will be used with thermistor to monitor the temperature of the speed controller.
4 ADC pins will be used to monitor the battery levels of all four bot batteries: 9V (logic), 12V (speed controller), 30V (motor 1), and 30V (motor 2).
1 ADC to measure sound loudness
3 interupt pins to determine sound speed and then calculate direction
3 ADC to measure analog output of sonar rangefinders
3 MOSFET switches to control power to each laser pointer
3 regular I/O to control servos
5 MOSFET switches to control power to each voltage regulator on the bot
2 serial pins (TX and RX) for communication to WiPort
1 MOSFET switch to control power to WiPort
1 I2C pin to speak to the other micro
1 interupt pin to say “yo, wake up!” to other micro

Whew.
That’s a lot.
And guess what…
That’s just what I expect my 18F micro to be doing!
I’ll eventually use the dsPIC for camera post-processing (it’ll interpret data sent back from RoboRealm software), and, perhaps, to do the audio timing, since it’s so fast and precise.
The 18F could certaintly do both of those as well as what it’s already doing above, but it’s a lot easier to break the code up into two more manageable pieces and stick one in each micro.

Just a thought to throw out there…
I’m willing to bet that the dsPIC can do sin/cos/tan calculation fast enough to be worthwhile.
If so, then all those nasty IK memory tables can be thrown out the window.
That should bring IK down to the level of most robotic hobyists.

Technically a BS2 can do sine and cosine without tables. However, implementing them without floating point numbers is really very painful. I don’t know how fast such calcs are needed for IK, and I’m not arguing that the dsPIC would be able to do them much faster than a stamp, but my guess is that it could be done. Also Parallax has a floating point unit for the stamp which is on the queue as a project so I can chuck my 8-bit cosine routines on my BOE-bot.

However, Nick is right that with this board you can do a lot of different things at once which a few combined would probably overload a stamp.

These processors have much more memory, so your program can be far more complex. You can also interface to large amounts of remote storage, such as SD cards. I have code linked to in the thread about other people doing just that. Once I get some basics down, I’m going to give it a try. Basic stamps, technically could, but you’d run into major limitations due to address sizes and lack of programing flexibility. If I understand correctly, these PICs could have a rudimentary ‘OS’ which could load different ‘programs’ from storage to main memory based on need. Although higher end stamps technically can do this too (but only within their own EEPROM), its a lot more painful since no program can be bigger than 2K and the largest memory you get is around 32K. Also cost is an issue, those stamps cost $70. This board is a lot cheaper. If I can build it with components I have lying around for the most part, it will cost me about $35, for the board, PICs, and a few crystals or FETs which I don’t have handy. This is less than a BS2.

Personally, I’m going to eventually try to do some vision recognition on the dsPIC. I mean, a BS2 with a CMUcam can technically do vision recognition so it should be possible. I know I’m not getting strong AI here, :stuck_out_tongue: but with more processing power I can make my bot sufficiently smarter.

All the files related to building the board are here:
geocities.com/saipan59/robot … ic_pcb.zip

I don’t have a parts list - let me know if you want one.

During assembly, be careful about part location and orientation, since there’s no silkscreen on the board. One of the pix in the zip has the mechanical layout, which helps during assembly.

Meanwhile, I just made code in the dsPIC to output stuff on it’s UART1, which (for me) will go to the SSC-32. The 18F has an I2C command to send the SSC string to the dsPIC.
It’s not tested yet, though…

Pete

Thanks. The only thing that I could really use now is suggestion values for D1-D6 and the switching transistors. Really its only D5 and D6 I’m a little confused about since I’ve never used zeners with an LM2940 like that, I can make a full-wave that matches my power source myself and I can choose some FETs etc. for my needs too. However, always nice to have some known working values especially since the driver limits choices.

I’m assuming since I’m probably not going to use the sparkfun transmitter, I don’t need the MC1455 (seems 555 compatible, why did you pick that one?) or its components.

Otherwise besides the PICs, MOSFET driver chip, one crystal, the zeners, and some caps small enough for the board I think I have all the parts I need.

D1-D4 are any type of small power rectifier, about 1 amp - I used 1N4001’s.
D5 and D6 are Schottky, not Zener (the symbol for a Zener is a little different). I used 1N5817’s. Here’s what’s going on in that part of the circuit: The goal is to have a “brown-out buffer” (C2) which would keep the MPU running for a short time if the battery V dipped due to a stalled servo or something. C2 provides the short-term juice, but I didn’t want it to drain backwards thru the output of the LM2940. So the diode stops the back-flow. BUT, the forward drop of the diode reduces the output of the regulator by about 0.3V. SO, putting another diode of the same type in the ground leg of the regulator raises it’s ground reference by 0.3V, so the net output is still 5.0V. Assuming C2 is 470uF and the current drain from the MPU’s is 40mA, it can withstand about 50 mS of power loss. In retrospect, that ‘feature’ may not be worth doing, because the MPU would need to check the battery V pretty often, to know when to kill the power to the servos. Or, I could make the PIC detect a brown-out, because I think it has a gadget in it for doing just that… So maybe 50 mS is OK after all… This needs more thought.

The MC1455 is a CMOS version of a 555, which saves a lot of power. The standard 555 is a current pig. In the circuit, the 555 is acting as a “resettable 1-shot”, to provide power to the xmtr. When a character comes, the 555 turns on the xmtr for about 0.1 seconds. Additional characters keep the xmtr on. About 0.1 seconds after the last char, the xmtr is automatically turned off.

Pete

I just uploaded a new copy of the zip with the pcb stuff in it:
www.geocities.com/saipan59/robots/dualpic_pcb.zip
I fixed the missing component names on the schematics, added C2a to the PC layout, and tweaked a couple of other things in the layout.

Pete

Wow. Thanks for the prompt reply. I downloaded the new files, and I think I’m all ready to build. I believe I understand the explaination and should have a few suitable components around. Time to start going through the pile. :slight_smile:

Yea, I’ve noticed the 555 causing lots of problems with current draw in other projects. Nice to know a solution to that. I’m assuming that chips like these weren’t used in my EE classes due to the fact we had a bunch of older chips on hand, or that being CMOS it was believed they’d be too delicate. While I’m sure early CMOS was more sensitive than its TLL equivalent, newer chips seem to be just as hardy.

I like the duel processor idea for multi tasking.

Thanks guys for taking the time to explain about the use of these PICs on this board. When you guys start talking about math my face goes —> :open_mouth:

I am in desperate need to pick up a few books on this stuff. I learn best by lying on a couch, reading a book for maximum comprehension. For some reason I learn better by laying down vs. sitting up… :laughing:

I feel the same way sometimes, as I will be new to PIC programming like what is required for this board. I can handle the ‘C’ just fine after I get back into writing ‘C’ code again.

This board will be far less expensive than paying $170.00+ for a controller to run Linux on for true multitasking. The other real alternative is the Propeller chip from Parallax, and somebody has designed a nice board for it also.

8-Dale

SN96 wrote:

I recommend starting with Nuts & Volts magazine. They have a column “Getting Started With PICs”, and other PIC-related projects.
You’ll learn a lot from the other articles and columns, too.
If you get a PIC book, you won’t get as broad an exposure.

Pete

Today’s progress:
The board can talk to the SSC-32!

  • The 4620 PIC puts together the ASCII strings destined for the SSC.
  • The 4620 sends the strings via I2C to the dsPIC.
  • The dsPIC sends the strings out UART1 at 38.4 kbaud to the SSC.

The 4620 could also talk to the SSC directly thru it’s own UART, but I want that UART to be dedicated to “console output” to report status, errors, etc.

I think it’s time to replace my bot’s brain with this new board…

Pete

Wow, Pete! This is excellent work you are doing! I will get a board as soon as you have the newest design created. I think this could be as good as a Propeller chip. :slight_smile:

8-Dale

would u say this could be used to learn C? because this sounds very promising, but i do not know C, maybe use this as a learning tool? :confused:

I don’t know how you learn best, but usually I need some sort of purpose for new knowledge before I will learn well. I need some way to apply any new knowledge I will gain by learning new things.

A good example is I never paid much attention to putting video on a website until I got my robot working. Now I have a reason to learn how to do it, so I dug in and kept at it until I got it done, which I did. Now I have my first video on my website!

It would work the same for me and robotics. I wanted to learn about it and now I have a robot to experiment with. I have already learned so much! I have so many things I want to do with this little robot, but I have to decide which to do first, so learning about all the different sensors, how they work, and how to use them is my first project.

If you really want to learn something new, there isn’t a better way than to just jump right in and start a project. Define what you would like to do and then gradually get the knowledge you need to do it. Before you know it you will be doing it! :slight_smile:

I would not consider this a first time building project though. If you are new to electronics and building projects, start out slow. If you just want to learn how to program in ‘C’, there are easier and better ways to learn that to start out.

8-Dale

To add to what’s already been said:
If you already feel somewhat comfortable with microcontrollers, i.e. you know the basic HW, have a programmer, and are currently using assembly, then yes, my board would be a great way to step up to the next level. Otherwise you might be biting off too much. *

If you just want to learn C, then a software-only approach is the way to go. Just learn how to write C programs for your PC, and avoid all the HW issues.

But if what you want is really “learn how to write C code to run on microcontrollers”, then an example of what you could do is this:

  • Download the free SW from Microchip (specifically MPLAB and the C18 compiler).
  • Buy a Microchip demo board and programmer that supports 18F-series PICs.
  • Learn the basics of C, and use the C18 compiler to make a simple program to make your PIC blinks LEDs and such.

A good basic programmer is this one:
microchipdirect.com/products … s=PG164120
It’s $35.
Then buy or make a simple board that supports the 18F-series PICs. A PICDEM2 or PICDEM4 are nice, but expensive (they include all sorts of gadgets such as LCD displays).
If you’ve got $$ to spend, there is a combo that includes the “PICDEM 2 PLUS” board and an ICD2 programmer.

Pete*

If you only want to learn C/C++ there are a lot better projects to do, since building this board takes some electronics know-how and many issues might be due to things like loose wires, or a bad component. In a pure software platform, assuming everything was installed properly, the only issue is with your code. Some personal favorite learning projects of mine are to learn KDE/Qt application programming with KDevelop or to learn about OpenInventor graphics programming (I’ve mentioned OpenInventor before). I’m positive if you’ve used a computer you wished there was a little program to calculate or parse something. With Qt you can make it rather easily. For a physics conference last year I wrote a small utility that calculated the aging differential for the twin paradox using the equations of special relativity given two of the three inputs, distance, speed, and/or time spent traveling. It took me about a hour or so to make. Another nice thing about either of these is that they can be done 100% for free on nearly any computer running Linux. If you’re running Debian or a close Debian based distro, I can even give you the package names you need to apt-get to get up and running.

I’d suggest a general C book. K&R is okay, but nearly all modern C stuff is at least ANSI C, if not C99 programming (these have minor differences which can confuse beginners). Teach yourself C in 24 hours was the book I started off with about a decade or so ago. It’s even online for free: aelinik.free.fr/c/ Honestly after this book, the biggest problem will be becoming completely familiar with standard library functions. However, google is your friend here and gives plenty of documentation for most stuff.

If you want to learn C/C++ under windows, I can recommend Practical Visual C++ 6.0 since it will teach you how to make a lot of simple programs and all of the general basics. Note, that this is rather outdated (most Windows stuff is .NET now, not Microsoft Foundation Classes), but I haven’t done much newer Windows stuff. It’s the equivalent of KDE programing and afterward the only real difference between the two is the class references (which for KDE and Qt are all free online). The M$ stuff is also somewhat free, basic documentation can be found online, but for many things to actually be able to use it you need a book or the more detailed references in a suitable version of Visual Studio.

wow :open_mouth:

thanks for all the suggestions guys, i want to learn C as it seems many of the more powerful micros seems to run it, and so it would allow me to build bots with more power processors in the future

but again, thanks for the suggestions for everyone that put in :smiley:

btw saipian, where is that software u mentioned on the microchip website? i cant seem to find it, do i need to register? (sry for hijacking your post too :blush: )

The C18 compiler is here, under Products / Development Tools:
microchip.com/stellent/idcpl … t=SW006011

Other SW tools are here:
microchip.com/stellent/idcpl … &nodeId=81

Pete

thanks man :smiley: