Help with PIC selection

Good plan.

Correct.

No, with steppers you always know their postion and speed by the fact that the software explicity does each 'step'.

Here is what I suggest.

1) Use a PIC16F628 for the keypad - one input per button. Send out the button number from the serial port as a series of single bytes repeating for as long as you hold the button down.

2) Program anothe PICF628 to recieve the serial data, and run one stepper motor. The PIC should only react to 2 of the six codes; one for forward and the other for reverse.

3) Now duplicate #2 for the other 2 motors programmed for the other numbes.

This system can be expanded for any number of motors from a singe keypad, and only 2 PIC designs are needed - keyboard and motor.

--
Luhan Monat (luhanis 'at' yahoo 'dot' com)
"The future is not what it used to be..."
http://members.cox.net/berniekm
Reply to
Luhan Monat
Loading thread data ...

PIC18F4220 in DIP-40. You can probably use the internal oscillator. $8.40 one-off. Program it in assembly using the free MPLAB, and pick up an ICD2 for about $150.

Best regards, Spehro Pefhany

--
"it's the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

Greeting All,

I've been looking for an excuse to play with PICs and I think I've finally found one. The question is, which PIC do I want to start playing with?

The goal:

Control 6 bipolar stepper motors with a hand pad. The 6 steppers will be configured in two sets of 3. Each set of 3 steppers will control the tip / tilt / piston action of a telescope primary mirror.

Here's a picture to show what I mean:

formatting link

In the picture an arrow points to the three manual knobs I use to perform the action. I'd like to replace the knobs with stepper motors, so I can do the adjustments while I view thru the system. BTW, the picture shows one primary for a Bino-Scope, thus the need for

6 stepper motors.

Requirements:

#1 At least 24 digital outputs

#2 A single analog input (stepper motor speed)

#3 6 digital inputs for hand pad buttons

Loose Preferences:

#1 Programmable in Basic, else Assemble, else some version of C (in order of how comfortable I am with each language)

#2 I don't think I need a high speed PIC, nor do I think I need much for memory. (but what do I know)

#3 Something cheap and easy would be nice.

Of course, I don't have any PIC experience yet, so I'd be starting from the ground up. However, I do have a lot of experience controlling stepper motors from a personal computer, so at least I have some clue as to what I need to do..

Any suggestions would be greatly appreciated.

Take Care, James Lerch

formatting link
(My telescope construction, Testing, and Coating site)

Press on: nothing in the world can take the place of perseverance. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination alone are omnipotent. Calvin Coolidge

Reply to
James Lerch

The price difference between the cheapest and most expensive PIC that can reasonably be suggested is maybe $ 10. Do you realy consider that significant? So go with the 'biggets' one, I'll second for an 18F452 of (slightly better) 18F4520.

You could buy a Basic compiler, but that ain't cheap. MPLAB assembler is free. The Microchip C18 compiler does not create the tightest code, but the demo is free.

And do read

formatting link

Having said all that I stick to my pic-newbie advice: the best pic (or other uC) for a newbie is the one that is neighbour (or anyone else near you who can help you) uses.

Wouter van Ooijen

-- ------------------------------------

formatting link
Webshop for PICs and other electronics
formatting link
Teacher electronics and informatics

Reply to
Wouter van Ooijen (www.voti.nl

Hi James,

I think an PIC16F874 or F877 (or the -A version) will be the best choice for your project. Enough digital inputs and outputs, also 10 bit analog input.

Build one of the self-made ICD (not ICD2) units and connect it to MPLAB Version 5.70. I know, it is not the newest version, but this gives you the ability to do in-circuit-debugging without buying an expensive debugging unit.

The ICD will help you a lot.

HTH Wolfgang

--
From-address is Spam trap
Use: wolfgang (dot) mahringer (at) sbg (dot) at
Reply to
Wolfgang Mahringer

"James Lerch" wrote in message news: snipped-for-privacy@news-server.tampabay.rr.com...

Others have answered about the 'processor' as such. It is worth being aware, that if you want to get good torque, and speed from a stepper, forget about running a 12v motor at 12v!... Basically the 'voltage rating', given in this context, is the maximum voltage that can _continuously_ be applied to the motor coils without overheating. This works fine if you keep the step rates very low, but if you want to move more quickly, the inductance of the coils is such, that if the power is applied for only a short time, the power being delivered into the coils falls massively. Hence for good stepper performance, you use a driver, that delivers a much higher 'endpoint' voltage to the coils, and then limit the maximum current, either with a series resistor (cheap, but has to dissipate significant heat), or with a current sensor, and PWM drive. You also want to ramp the actual speed fed to the motor. Remember also, that if this system is to 'retain' knowledge of where the motors are set, the position will need to be stored in EEPROM (assuming there is no battery backup). Writing the position will take quite a few mSec, and if you repeatedly do this for every movement, it is suprising how quickly the 'life cycle' of the EEPROM will get used up. Instead implement a power supply that can keep the processor powered for a fraction of a second when power is removed, and implement a 'power fail' interrupt, then write the positions if they have changed, when this interrupt triggers. You might also want to consider implementing 'backlash correction' in the motions, and allways approaching a selected point from one direction. Unless your mechanism is 'perfect', there will still be a small amount of residual backlash in the hardware...

Best Wishes

Reply to
Roger Hamlett

Thank you gentlemen!

I'm replying to myself, as I am obviously at the low end of the learning curve, so my apologies. However I do appreciate the detailed replies.

To date, I've built 4 separate projects all using stepper motors and my own home rolled Visual Basic code in Window$ as the control method. All so far have used the parallel printer port as the IO port to talk to a dumb amplifier to actually power the stepper coils.

Basically, this project is just going to be a very simple stepper motion control. No need for remember where things are (other than what coils are on so as to implement the next step function)

In its simplest form, the code will look something like this

Do

If button_press then move some motor one step in some direction Pause a period of time based on analog signal from hand pad

End if

Loop

Of course, I imagine as I open this Pandora's Box, goals and expectations are going to rapidly change :)

Thanks again for your time! Now all that's left is everything :)

I'm off to do my PIC homework!

Take Care, James Lerch

formatting link
(My telescope construction, Testing, and Coating site)

Press on: nothing in the world can take the place of perseverance. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination alone are omnipotent. Calvin Coolidge

Reply to
James Lerch

You mentioned needing 24 outs for the steppers and though I'll not try to talk you out of playing with big PICs, you don't need that much. You can use 2 line stepper controllers (direction/step) and demux and latch them to the steppers or even use 4 PIC lines (store each stepper's last state so you can multitask them when more than one input is active) and some address lines to demux the control sigs.

--
Best Regards,
Mike
Reply to
Active8

I could go this route, and actually gave it some thought, but decided against it. Since this is going to be a one off hobby board, and I won't be etching a circuit, but using three hole per trace "universal Dip Bread boards" I'm leaning towards keeping the part count (and their corresponding jumper wires} to a minimum.

So in this case the big hammer and Kiss principal seem most appropriate, IMO :)

While I still have soo much to learn about PICs, I'm hoping to keep the part count down to as few components as necessary. For instance, I'm hoping to use only

1x 7805 1x Pic 12x Mos-Fets 4x momentary push buttons 2x SPST toggle switches 1x reostat

And of course some caps, resistors, cable connections as needed..

Well, that's what my naive brain is telling me at the moment.

I'm currently researching HOW-TO move the code to the PIC, and of coarse how to write the code to program the PIC with in the first place. ;)

Of course, it would be real nice if I could update the PIC in circuit, and even nicer to be able to watch what's going on from the PIC in real time on a PC, and even better would be the ability to make the PC

- PIC connection myself via either a Serial or Parallel port.

Currently I just don't know enough to know what is feasible and what isn't, but I'm sure the information is out there somewhere just waiting for me to read it :)

Take Care, James Lerch

formatting link
(My telescope construction, Testing, and Coating site)

Press on: nothing in the world can take the place of perseverance. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination alone are omnipotent. Calvin Coolidge

Reply to
James Lerch

I forget what all's been posted, but

formatting link
- also on yahoo groups
formatting link
- i think it is.

formatting link

and the links from there will take you to Wouter's boot loader, burner circuits, plans for ICDs, etc.

Most of the free software for burning in circuit doesn't support some popular chips and is otherwise lame. Like the one that supports the 16f628, but not the 648 which only differs by code and maybe EEPROM size. And there's no text file deal to allow you to add a chip.

You might just want to buy the burner/ICD from Microchip.

I might write my own from the open source Linux burners. Speaking of which... if you use Linux, check out Scott Dattalo's gpsim at

formatting link

--
Best Regards,
Mike
Reply to
Active8

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.