PIC control board PCB

I have not heard of SMC.

SMD I have herd of, which means surface mount device.

SMT means Surface mount technology and, Through Hole means parts where the leads pass through the board.

But, if you want to use SMC, then more power to ya…

:laughing:

And to add, R8 looks like it will interfear with P2

The layout-picture (silkscreen) shows the outline of connectors with shrouds, but I intended using just simple pin-headers.

But the layout is definitely a bit crowded… I’ve spent a bunch of hours fine-tuning the layout. I was only able to add some small prototyping areas, scattered around the board. Many folks probably don’t care about Z1 and U7, so you can ‘hijack’ that area for something else if you want.

I intended that everything can be done with (small) through-hole parts. The small R’s, C’s, and D’s can be mounted vertically (one lead bent back 180 degrees) as needed. But SMT’s should work too, but you’d need to figure out which package size is best.

I think you’re looking at an old version of the schematic. In the current design, R1 sets the charging current limit, and is just a simple resistor. There is no longer any voltage regulation in the battery charger circuit. The plan for the charger is that the HW (U2) limits the max current to whatever value you choose. The PIC can monitor the battery voltage via R2, R3, and the “BattVolt” signal. Optionally, you can insert a FET switch in place of JP1, and allow the PIC to stop the charge at the right time. Another option is to use a very low charge rate (such 0.03C) such that you never need to stop the charge. A third option is to add some more HW of your own at JP1, and use it to control the charge on/off and such.

Pete,

I would like to see your design with traces. If you can get a pic when you have time, I’d like to see it.

Hi Mike,
I just e-mailed a ZIP to your botwire address.
I’ll post those pics, plus the ExpressPCB files to my web site tonight.
I can’t log into my site from inside the company firewall for some reason…

Pete

I just put a ZIP file here:
www.geocities.com/saipan59/robots/dualpic.zip
It contains the ExpressPCB files, images, schematics, etc.

Unless I hear from someone else soon (within a day or so), my plan will be to order 6 boards.
I will reserve 2 for Tillin9, and one for Nick, and the rest are for me. Nobody is obligated, though. No money in advance. After I get the boards, I’ll build one up and do some basic testing.

Pete

I ordered the boards tonight. I will get them on Monday the 9th.
The latest docs are here:
www.geocities.com/saipan59/robots/dualpic_pcb.zip

Pete

The boards should be in some time today. Will you post some pics of it when you get them in?

The boards are in - I’m building one now…
I’ll take some pics tonight or tomorrow.

Pete

Here is a quick/fuzzy pic of a partly-assembled board:
geocities.com/saipan59/robots/proto.jpg

Found one bug in the design - the LM2950 regulator needs a bypass cap on the left side of the diode. The cap on the right (470uF) doesn’t help because the diode isolates it. As is, the 2950 is unstable. A pair of small tantalums added to the back side of the board fixes it.
I’ll give more detailed advice to Nick & tillin9 later.

Everything else seems good so far!

Pete

Wow, thanks Pete for the pics!

That problem you have is a small prototype error. It’s amazing thats all that was wrong with the design the first time though considering the complexity of the design.

Good news!
I just got the main PIC (18F4620) working with the serial port.
I had been struggling with it since yesterday, and couldn’t get the PIC to execute any code. Finally I realized the problem: My code was leaving “Low Voltage Programming” enabled. LVP is done via pin RB5/PGM. On this board, RB5 is not connected to anything, because I’m using it as a general-purpose I/O pin, so it floats “high”. SO, the chip goes into Programming Mode automatically, which prevents it from running any code. The fix was to disable LVP mode in the code (an alternative would be to pull down RB5).

This means that all the functionality has been verified except for the dsPIC, which will hopefully be a no-brainer…

Nick, Tillin9: If you’re still interested in getting a bare board from me, please make contact about sending me the $$ and your mailing address.
Nick: The cost for one board would be $26.50.
Tillin9: The cost for 2 boards would be $51.50. You are not obligated to buy two (or even one).
My address is read like this: saipan59 at att dot net ].

FYI: I’ll be out of touch for the next couple of days.

Pete

I just updated the docs:
www.geocities.com/saipan59/robots/dualpic_pcb.zip

I added “C2a” on the first page of the schematic. It is the only known problem with the design (and is not covered by the PCB layout).

I’m working on code now…

Pete

I posted some code for the board here:
www.geocities.com/saipan59/robots/dualpic_code.zip

This code is for the 18F4620.

It doesn’t do much yet - it just toggles the RA2 pin every second, using Timer2 and an interrupt. It also spits out a line of text on the main serial port.

As-is, it runs at just 1 Mhz using INTOSC. By commenting-out 3 lines in pic_main.c, it will run at 10 Mhz from an external crystal, but the timing stays the same - RA2 wiggles at the same speed, and the serial port is still at 4800 baud.

There is a bunch of other code there which is being adapted from my bot’s previous brain. That stuff needs testing/debug to run on this new board. There are I2C routines, and stuff for doing quad-3DOF gaits via an SSC-32.

Next priority is to get some basic code running on the dsPIC30F4011.
After that, I’ll get I2C working between the two PICs, which will enable two more serial ports (one of which will be for the SSC-32).

Pete

Wow, fast work. At this rate by the time I get mine asembled, you should have worked everything out. :slight_smile:

I looked at the code, and was impressed. Honestly it looked a lot like a parallel version of linux driver code, of course without the kernel specific structures. Though I think the #pragma’s I saw are doing something different than I’m used to in cluster coding. Anyway I was having a bit of difficulty following everything. Maybe some comments might help? Or better yet, you could point me to some resources so I could teach myself?

Although a good web site would work, I think I need a professional PIC book. Googling for PIC programming gives an information overload. Preferably a book that writes to the compiler you are using to ease sharing codes. I think I’m finally warming up to using C instead of assembly (yes, I know eventually I’ll need to learn it for inlines), I think that was a big barrier last time I tried to do anything with the PIC.

I’ll try to add some more detailed commenting. For the moment, focus on pic_main and pic_sci, since those are the main parts that are definitely working.

I’m sure there are a lot of good books, but I don’t know which one to recommend. Meanwhile, I suggest downloading the free versions of MPLAB, and the C18 and C30 compilers from the Microchip site. Install them, and you’ll find example code, user’s manuals, etc.
I’m using C18 and C30 for this project, since they are free and easy to use with MPLAB. With these sorts of free tools, there isn’t much reason to use assembly. Once you have a “code base” of working C code to build upon, I think you’ll lose interest in assembly. In my own C code, I tend to do things in a rather straightforward way - I don’t use many “tricks” or “gadgets”, and I only use pointers when I have to.

BTW, your boards are “in the mail” this morning.

Pete

I also have downloaded C18 and will get C30. I like to do thinks the way you do - modularly. I have my robot CAD assemblies done the same way, so I can put models of various robots together faster and faster as I create more reusable subassemblies.

I used to have to program in C with pointers 3 and 4 levels deep, and -that- was a mind bender at times. Another mind bender and headache giver is converting BASIC code to C - and I have done more of this than I care to admit to. I did not work full days when I was doing this sort of thing. I’ve also converted Apple BASIC to Apple UCSD Pascal, which was not as difficult as it might seem.

8-Dale

I posted the latest code at:
www.geocities.com/saipan59/robots/dualpic.zip
From now on, that zip file will contain the latest code for both PICs, whenever I update it.
Starting today, the ZIP contains the complete set of MPLAB project files for both projects (“pic” and “dspic”).

Today’s functionality is the following:
Both pics run code and blink an LED.
Both have basic interrupts working.
The master pic can output stuff to its serial port.
The dspic supports clock-switching on-the-fly, which is really cool. It runs normally at 7.3 Mhz, but by making a simple function call it goes to 118 Mhz!

The next step will be to get them talking to each other via I2C.

Tillin9: I see that your boards were delivered to you today.
Nick: I trust that you got your board by now?

Pete

It would be a really good idea to version your code, and include the version in the zip file name. That way people will know they do or don’t have the latest code, and what version they do have. This makes it easier to talk about code in forums if people can reference the exact version of what they have. :smiley:

It also makes it easier to roll back to an earlier version if a major problem is encountered and to know what version you are going back to.

8-Dale

Good idea - I’ll do that from now on.

Pete