Connect with us

I/O board microcontroller...

Discussion in 'Microcontrollers, Programming and IoT' started by jonathantrue, Mar 5, 2010.

  1. jonathantrue

    jonathantrue

    4
    0
    Mar 5, 2010
    Ok, so I’m fairly new to the world of electronics and I’m hoping someone can provide me some general guidance on a project I want to create. While I am a novice, I’m very technically inclined, I have basic computer programming skills, I have assembled electronic kits that require soldering, and I’m not scared of research.

    What I want to do is create a compact circuit board that’s capable of accepting commands via a USB port and then executing a sequence that would involve opening and closing a series of 12V solenoid valves for a specified amount of time. That’s it. This probably seems very simple to many, so I’d also like to add that I’m not trying to have someone else solve this problem for me, I’m just looking for a little guidance and an understanding of what methods may be best and why.

    It probably sounds a little frat-boyish, but the whole purpose of this project is to create an automated drink dispensing system. (I’m remodeling my basement and creating a bar hangout area.) I know it’s been done, but I can’t find anything that exactly meets my criteria, plus I’m really interested in knowing “HOW” it works.

    My Criteria:
    1) Controls up to 12 – 12V solenoids
    2) Communication via USB
    3) Ability for the board to receive the entire command from the PC prior to executing (to avoid problems with lag in PC communication speed)
    4) Assign unique address to each board (For possible expansion via daisy chain)
    5) As compact as possible, and avoiding mechanical relays if possible

    I’ve been researching basic electronics, and I have some books on the way about PIC microcontroller basics… I have a feeling this is going to be a good option, but I welcome any of your opinions, ideas, and guidance. Like I said, my knowledge is very basic, so if you can provide any guidance on layout, components, as well as how it functions, I would really appreciate it!
     
  2. 55pilot

    55pilot

    434
    3
    Feb 23, 2010
    What you are basically looking for is a 12 output, USB based, relay controller. I suspect you should be able to buy it already built, so all you have to do is the programming on the PC end.

    Alternately, you can get a 12 digital output USB peripheral device and add the relays (solid state if you prefer) to it. I am sure you can get something like that, though I have no idea where (not exactly my area of interest). Once again, all you are doing is PC programming.

    If you can not get those things, then you will have to design, build and program the device yourself, which is what you seem to be planning to do. The PIC is a good choice, as are about a dozen other similar USB microcontroller. The main criteria for choosing one is what you know or what your friends know (so you can get help). You will take the microcontroller's digital outputs and add the relays. You will have to develop the USB communications protocol. You will have to write the PIC code. You will have to write the PC code. It is all very doable, but a lot more work than the first two.

    USB port can not be daisy chained. However, you can plug 4 USB peripherals into a hub or on the USB ports of a computer. But you have to keep in mind that all the USB devices have to have a unique ID if they are going to reside on the same computer. This means you will have to assign and keep track of serial numbers on the USB microcontrollers.

    Good luck.

    ---55p
     
  3. jonathantrue

    jonathantrue

    4
    0
    Mar 5, 2010
    Thanks 55p,

    Based on all of that, if I choose not to "re-invent the wheel", do you think this would be an acceptable alternative?

    http://www.phidgets.com/products.php?category=0&product_id=1012

    Reading throught the specs, it seems it would work in line with the solution you proposed regarding using multiple USB's and programming based on unique component ID's. (For expansion purposes)

    Then I would have 16 outputs for triggering relays, as well as 16 inputs to potentially add the option of buttons. Now I'm thinking with this option, I could manually use the buttons for triggering the relays, as well as the computer driven side...

    And with this option I could potential add the +- style of single relay boards to the controller as needed?

    Please correct me if I'm wrong on any of this! Thanks again.
     
  4. 55pilot

    55pilot

    434
    3
    Feb 23, 2010
    That looks like exactly the type of board I had in mind. Its outputs can drive your solenoids/valves directly. Take a look at the "Digital Outputs" section of the documentation for how to wire. You basically take a 12V power supply and connect it to one side of each of the solenoids. The other side of the solenoid is connected to one of the digital outputs on this board. When the output is "on" it is connected to ground and the solenoid sees 12V on one side and ground on the other and it energizes. When the switch is "Off" it is unconnected and there is no current flow and the solenoid is not energized. You need a flyback diode across the solenoid to keep it from killing the output driver.

    All your programming will have to be done on the PC. You can attach a number of these boards to a single PC through a USB hub. In your PC software, the devices are going to show up as unique devices, each identified by its serial number. You can either write your program to hard code to each serial number, or you can take 3 of the digital inputs and wire them to identify the board. This way you are not tied to a particular board and can change boards if one breaks without having to rewrite the code.

    Good luck.

    ---55p
     
  5. jonathantrue

    jonathantrue

    4
    0
    Mar 5, 2010
    Ok, so I have the I/O board, for my 16 outputs I have connections to +- relay boards… I'm assuming I should be switching the positive on the relays. (Via the C and NO terminals)

    Also when you say "You need a fly back diode across the solenoid ", are you talking inline with the solenoids positive feed? (See attachment)
     

    Attached Files:

  6. 55pilot

    55pilot

    434
    3
    Feb 23, 2010
    That is not how that board works. In the simplest terms, the "Output" of that board is a switch that is either unconnected or is connected to ground. You should look at the output section of the board's manual for a drawing explaining this.

    Assuming your solenoid requires less than 2A, you do not need the relay. You should connect the + to one end of the solenoid. The other end of the solenoid goes to "Output Number 1" of the board.

    The - of the external 12V power supply connects to the ground on your board.

    You need a diode where you have indicated. The cathode of the diode (the point of the arrow) connects to the lead of the solenoid that is connected to + and the other end connects to the other lead of the solenoid that goes to the board.

    ---55p
     
    Last edited: Mar 9, 2010
  7. jonathantrue

    jonathantrue

    4
    0
    Mar 5, 2010
    Ok, that makes perfect sense. Thanks for the guidance, I appreciate your time and patience!!

    JT
     
  8. saurabh17g

    saurabh17g

    72
    0
    Mar 8, 2010
  9. saurabh17g

    saurabh17g

    72
    0
    Mar 8, 2010
    @55pilot
    yes, thats true
    it will take a huge time and is risky as well. The whole intention is that he will learn to write USB drivers. Also, that micro controller has built in USB port. So he will not have to do any serial to USB conversion as he would had done if he were to use Pic micro which does not have USB(1st quote).
    If he does not have time, he can go ahead by purchasing the kit but he should try to write driver himself. That will be more interesting thing to do than to just pass some bits over existing APIs. Frankly, i have not written any such USB driver. I myself am quite curious about doing such stuff.
     
  10. saurabh17g

    saurabh17g

    72
    0
    Mar 8, 2010
    @pilot,
    my message has gone up. pls check it. I tried it hard to get down but it dint happen
    sorry for inconvience
     
  11. 55pilot

    55pilot

    434
    3
    Feb 23, 2010
    Let me try and understand what you are suggesting. Instead of buying a built up board with microcontroller code already done, tested Windows drivers and reference code for the PC, you are suggesting that he should buy a chip, do all the electronics hardware design, design, build and assemble a PCB, write the microcontroller code, write or cobble together USB drivers for the PC? All of that will get him to the same point as he would be by buying the board, except it will take him several months and cost more money, all of that assuming he does not make a huge mistake and has to start over again. Surely I am missing something. What is it?

    ---55p
     
  12. 55pilot

    55pilot

    434
    3
    Feb 23, 2010
    Who are you to decide what he needs to learn? If someone asks for a way to do a certain project, that is what you suggest. You do not start misleading them in doing things that you wish you were doing.
    Using your logic, let me suggest some books on chip design. You should create your own ASIC. You will learn a lot and it will set you back only a few hundred thousand dollars extra. Sounds like a good idea to you?

    ---55p
     
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Loading...
Electronics Point Logo
Continue to site
Quote of the day

-