Handling hundreds of digital I/O

Discussion in 'The Projects Forum' started by Suwandy, Jul 24, 2016.

  1. Suwandy

    Thread Starter New Member

    Aug 7, 2015
    3
    0
    Hello everyone,

    Suppose you were tasked to design a project about car parking counter in a shopping mall with description:
    1. The parking slots are hundreds (say 100 for simplicity)
    2. They want to put a light above each parking slot to indicate vacant spot (100 output)
    3. The system has to count how many vacant and occupied slot (100 input)
    How would you approach this?
    I assume using MCUs as controller, but i couldn't figure out how to handle 100 I/O. There must be a digital technique that can be implemented to deal with many I/O. A bit research and i found articles mentioning multiplexer, 8255, shift registers. My humble question, which do you think work best? with consideration the number of I/O could still grow up to 1000.
     
  2. dannyf

    Well-Known Member

    Sep 13, 2015
    2,196
    421
    1) get a mcu to handle any number of IOs that you can figure out; call those slaves.
    2) get a master to pull those slaves.
    3) done.
     
  3. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    3,110
    3,965
    This is what I would do:

    Each space has a module that consists of: a parking sensor, a lamp, a CPU, and a radio capable of ad hoc networking (i.e. Zigbee, etc.)

    The CPU can manage turning its own lamp on and off based on the status of the sensor.

    Each CPU transmits its status via the ad hoc network to a central base station which keeps a record of spaces occupied or empty and a total count.

    No wiring required (except for power), and all parking units are identical thus low cost and ease of manufacturing.
     
    Suwandy likes this.
  4. MaxHeadRoom

    Expert

    Jul 18, 2013
    13,166
    3,632
    The old (1970's?) 8255 was used for I/O interfacing with the 8080/8085 CPU.
    It also depends on what devices you intend using for detecting vacant lots to switching outputs such as lights etc.
    I would look at some kind of remote I/O/PLC based system either Modbus based or look into the Opto22 system which might offer some suitable answers.
    http://info.opto22.com/pacs-vs-othe...m_source=ppc&gclid=CL7EtqLPjM4CFYM2aQod9n0FgQ
    Max.
     
  5. Sensacell

    Senior Member

    Jun 19, 2012
    1,514
    404
    Q: Whats the most expensive and difficult aspect of the problem?
    A: The wiring.

    Design the system around using the least possible wires, which means you don't want all the wires going to one central place.

    Create hubs that can be located in areas where there is a high concentration of parking spaces.
    The hubs collect data from many parking spaces, hubs concetrate the paralell data and communicate over a single pair using a serial protocol
    Each hub connects to a master serial bus that is polled by a master computer.
     
    Suwandy likes this.
  6. Suwandy

    Thread Starter New Member

    Aug 7, 2015
    3
    0
    Thanks for your idea. Hmm ya this sounds valid. Say each MCU has around 32 I/O pin, and the requirement slot grow to 500 I/O. Does that mean we need many many MCUs? yes, it will work if we hook everything up but the thing is MCU has too few I/O. Is there a way we can expand MCU I/O slots?
     
  7. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    3,110
    3,965
    That's what I said. But without the wires and hubs.
     
  8. dannyf

    Well-Known Member

    Sep 13, 2015
    2,196
    421
    it depends on the nature of such sensors.
     
  9. Suwandy

    Thread Starter New Member

    Aug 7, 2015
    3
    0
    Wow guys, thanks for the great ideas in short amount of time. It took me some minutes to process what you mean. All of your solutions sounds cool!

    Demn i like your idea Joey! it never crossed my mind to use wireless communication. Quick question: if every space has it's own module, wouldn't it cost a bit much? the cost of ad hoc networking i presume will scale up as the number of module increase.

    Thanks Max for pointing this out. I assume to use proximity sensor to detect (is there a better way?) and relay to switch light on and off.

    Wow i couldn't agree more with your idea Sensacell. Surely wiring is a problem with a project of this scale. For each hub with such capability as you defined it, what kind of cpu do you see fit for the job?
     
  10. MaxHeadRoom

    Expert

    Jul 18, 2013
    13,166
    3,632
    On remote stations I have used the Opto22 G4 S.S. modules, the boards come in different capacities 4 to 24 modules and have 5v I/O and switch or detect voltages from 5v to 240v.
    The boards accept control communication from different sources 4-20ma, parallel, Opto22 system buss etc.
    If switching higher power output devices an intermediate relay can be driven by the Opto22 output.
    Max.
     
  11. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    3,110
    3,965
    Each module is going to cost less* than the cost of wiring. And long term maintenance becomes trivial.

    The ad hoc network has zero cost -- regardless of the number of nodes. Just choose a network technology that can support the number of nodes you will require in the future.

    *Edit: the incremental cost of adding a CPU and radio to each module will be less than (probably significantly) the cost of wiring sans CPU/radio.
     
  12. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    3,110
    3,965
    As far as cost is concerned, I'd spend more time developing a low-cost reliable "automobile" sensor. You could use an inductive loop or weight sensor buried in the pavement (very reliable but very expensive), a camera with software capable of detecting the presence of an automobile (reliable and less expensive), or an optical sensor capable of detecting reflection from an object in the space (not so reliable but very cheap).

    No matter what, you'll need to reliably detect everything from a truck or large van down to a small moped.

    Edit: And remember -- sometimes cars are double parked or parked in awkward ways.

    This, IMHO, is the major part of the project.
     
    RichardO likes this.
  13. MaxHeadRoom

    Expert

    Jul 18, 2013
    13,166
    3,632
    Check out the Opto22 PAC paper and the wireless section.
    Max.
     
  14. tcmtech

    Distinguished Member

    Nov 4, 2013
    2,707
    2,485
    If people who are driving the vehicles can't figure out whether or not a parking space is open or not without an indicator light as they drive by they don't need to be on the road at all. :(

    I mean what happens if a parking space indicator fails and gives a false empty indication to a space that actually has a vehicle in it? How many idiots are going to rear end that parked vehicle now because the wrong light was on? :eek:

    The simple solution would be to just count how many go in and how many came out and keep a running tally from that and when the parking lot is full stop letting people in until someone leaves. Or is finding someone who can pay attention well enough run a $5 handheld up-down counter and an entryway gate that hard nowadays and a multi-tens of thousands of dollars installed cost system with lots of fancy blinking lights need to be implemented instead.? :rolleyes:
     
  15. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    3,110
    3,965
    They have such a system at Universal Studios in Florida. It is quite convenient.

    It is a multilevel parking garage. Upon entering a level, there is a sign telling you how many spots are available on that level. If you wish, you turn into that level.

    Each parking row has another sign telling you how many spots are available in that row.

    Then, each spot has light above it that is green if empty or red if occupied. The lights can be seen from across the expanse of the level. It makes navigating for a parking spot much easier and quicker.

    I had to laugh to myself, though, when I noticed an "unoccupied" spot with an MG Midget in it -- and not pulled in all the way (though it was within the confines of the space). The car was too small, I suppose, to be detected.

    Edit: And, I suppose it is worth the expense. Less time spent parking means more time spent spending money in the park and at the shops/restaurants.
     
  16. AnalogKid

    AAC Fanatic!

    Aug 1, 2013
    5,653
    1,605
    I see two things, the sensor and the comm. The comm, as above, is either wireless (but the nodes still have to get power somehow), or wired. If wired, then a simple 2-wire party line can wander all over the lot and touch each location. Comm speed is trivial since a 10 second delay between empty and indicated is acceptable, and a 1-second delay is basically instantaneous, and easy. So, wired or wireless?

    Sensor - lotsa ways to detect the presence of a large steel mass, a bit more tricky for a motorcycle. Probably don't want to put an in-ground inductive loop sensor in 1000 places. Do you have any predispositions/guidance about the sensor?

    ak
     
  17. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    3,110
    3,965
    Power is generally universally available in parking lots and garages, at least here in the US. Tapping an existing power line is trivial compared to running one or more additional sets of wires to each parking space -- including all the new conduits and junction boxes that would be required.

    And, no, one would not be able to use the existing line-power conduits to house the low-voltage data lines!
     
  18. AnalogKid

    AAC Fanatic!

    Aug 1, 2013
    5,653
    1,605
    Carrier current.

    ak
     
  19. WBahn

    Moderator

    Mar 31, 2012
    20,234
    5,757
    You need to get power to the lights anyway. Presumably this can be branched off existing power conduits, but I imagine wiring codes could make it so that you have to run additional circuits for the given number (and distribution) of lights needed. Assume that power distribution to all spots are taken care of, then one option would be to use power-line signaling for your communications, but if that's not possible then RF probably is (though you might need a number of hubs given that large concrete structures are generally pretty unforgiving of RF signals). Using an ad hoc network should get around this problem as long as there is at least one viable route from each stall back to the control center.

    Even if you decide to use physical wires for signals, you do NOT need lots of I/O pins. You use a shared medium and simply assign a unique code to each device.

    There are a number of alternatives available to you, each with its own pros and cons. As has already been pointed out, perhaps the biggest challenge is to reliably determine if a parking spot is actually available. But this doesn't have to be perfect. If a stall is occasionally marked incorrectly, people will grumble but probably readily accept that no system like this is going to be perfect. But if people encounter multiple mismarked spaces, then they will lose confidence pretty quickly.

    Keep in mind that you don't have to have a complete sensing module in each slot (though that approach has some obvious attractions to it). You might have a camera or a radar unit that can monitor multiple spots, for instance, and it sends the information back to the control station (or some intermediary), which then sends out commands to the lamps mountain above each space.

    In principle, an approach such as this would allow you to use cheaper radio hardware because the sensors (of which their are a lot fewer) only have to be able to transmit and the lamps (of which there are a lot more) only have to be able to receive. This is provided that you can deal with medium access under those conditions -- which you can if you were to use something like concurrent-code spread spectrum (for which there's no hardware available yet, but you could roll your own).

    Something you might look at, just for ideas, concepts, issues, etc., are SCADA (Supervisory Control And Data Acquisition) networks, which have a fair amount in common with what you are trying to achieve.
     
  20. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    3,110
    3,965
    I had in mind a single module that contains the electronics (CPU, radio, etc), lamp, power supply (from mains), and sensor (probably cheap CCD video), and lots and lots of software. One module could be bolted to the ceiling of the parking garage for each space, or mounted on poles sans ceiling. All the modules would mesh and report their status to a master PC somewhere on the internet. I bet I could manufacture something like this for somewhere between $20 and $50 ea. in high volume.
     
Loading...