magnet control through PIC


Closed Thread
Results 1 to 23 of 23

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Depending on the wattage of the magnets, there are several ways to control them. Use PWM or maybe even FREQOUT. Connect the mag circuit to you chip with an opto-isolator or drive the mags with a MOSFET or IGBT. There are pros and cons to each though.

    How many more mags than pins? How many mags need to be on at a time? Look at some of the recent post about LEDs, add driver hardware and...
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    Hi SterlingY,

    Don't know your level of expertise, but if it would help, there's a book out for Basic Stamps (these are PIC's) called "The Microcontroller Application Cookbook" that has a chapter on expanding I/O using only a few port pins and it has some code examples. Volume 2 also has some interesting I/O examples. These books are available from www.parallax.com and www.nutsvolts.com and probably from Amazon.com.

    HTH,

    BobK

  3. #3
    Join Date
    Mar 2007
    Location
    West Hollywood, CA
    Posts
    38


    Did you find this post helpful? Yes | No

    Default

    Thanks for the book info. I'll check them out. Can't hurt to have them around.

    As for how many mags to control at once, all of them. I would assume that I have 2 PORTS available for their control.

    -Sterling

  4. #4
    Join Date
    Jan 2006
    Location
    New Hampshire, USA
    Posts
    107


    Did you find this post helpful? Yes | No

    Default

    That reminds me of the cemetery joke: How many people are dead in that cemetery? Answer: all of them!

    My idea of using the '154 was that 8 of them could be connected with their inputs in parallel. The enable port on the '154 would be connected to 8 pins on the PIC to select the group of 16 magnets. that leaves 4 pins on the PIC for other control.

    Russ

  5. #5
    Join Date
    Mar 2007
    Location
    West Hollywood, CA
    Posts
    38


    Did you find this post helpful? Yes | No

    Default

    Forgive me for asking this stupid question, but wouldn't that mean that each '154 would be the same as the others: if output 3 is HIGH on one then it is HIGH on the others?

    Another question, which is a better interface I2C or Serial Data? Microchip make a 16 channel port extender in both formats.

    -Sterling
    Last edited by SterlingY; - 19th March 2007 at 03:21.

  6. #6
    Join Date
    Jan 2006
    Location
    New Hampshire, USA
    Posts
    107


    Did you find this post helpful? Yes | No

    Default

    wouldn't that mean that each '154 would be the same as the others: if output 3 is HIGH on one then it is HIGH on the others?

    Only the enabled IC has an output.

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by SterlingY View Post
    Forgive me for asking this stupid question, but wouldn't that mean that each '154 would be the same as the others: if output 3 is HIGH on one then it is HIGH on the others?

    Another question, which is a better interface I2C or Serial Data? Microchip make a 16 channel port extender in both formats.

    -Sterling
    I2C....because PBP has built in I2C handling capabilities (sure, it's got serial and SPI also, but I find I2C a bit 'cleaner' if that makes any sense).

    On the '154...
    The '154 has 4 inputs to control the 16 outputs, it's also got an enable line which turns the chip on or off.
    You take a 5th bit from the PIC and drive that enable line with it. If you're driving 2 '154's, you have to invert that 5th bit going to one of the '154's, that way when one is on, the other is off.
    If you want to drive a whole load of '154's, you can take 17 '154's, connect 16 of them in parallel (with say D0-D3) except for the enable line, take the 17th '154, connect it to another 4 bits from the PIC (say D4-D7), and use each of the 17th '154's outputs to drive the other 16 '154's enable line. And you'll end up with 256 individually controllable outputs. (or you could do the same thing with a '138, but with 8 '154's instead of 16 of them, or just not use all of the outputs of that extra '154 connected to D4-D7).

    Another thing, with the '154, all you'll get is ON and OFF, nothing in between. You mentioned that you want to vary the strength over time. The '154 won't do it because you can't run multiple channel pulse-width modulation through it. You could easily set up an 8 channel software driven pulse-width modulation program and drive a bank of MOSFETs with the PIC and control the magnets that way. I've done exactly this with an 18F8722 and bank of 22 RGB LEDs (66 individual LEDs total). Replace those LEDs with n-channel MOSFETs or a bunch of ULN2803A's and you've got instant magnet control (well, as long as your power supply can handle it and doesn't cause the PIC to reset!).

    Let us know if I dumbed this down too far for you, or maybe not enough, or whatever. We'll get you straightened out...

  8. #8
    Join Date
    Mar 2007
    Location
    West Hollywood, CA
    Posts
    38


    Did you find this post helpful? Yes | No

    Talking

    OKAY!!!!

    This is starting to makes sense. It sounds so cool, I want to build the multiport system just to build it for something, anything.

    Of course to make my problem more difficult, I am now in the process of builing my own electromagnets. That's a whole other field to learn. My problem is making them strong enough without starting a fire.

    -Sterling

Similar Threads

  1. DTMF and PIC for Remote Control
    By doggitz in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 30th March 2010, 11:42
  2. Replies: 5
    Last Post: - 12th September 2007, 15:59
  3. Motor Control PLC with a PIC
    By sougata in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 2nd November 2006, 07:59
  4. Pic Control With Software
    By Agent36 in forum General
    Replies: 5
    Last Post: - 18th October 2006, 18:18
  5. Need help on pic to pic flow control (simple problem I think)
    By khufumen in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th January 2006, 00:34

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts