Shop OBEX P1 Docs P2 Docs Learn Events
I have an idea, but need confirmation — Parallax Forums

I have an idea, but need confirmation

Hello all,

I am working on a project for a friend, that has 1000 touch sensors. I am using microchip's CAP1188 touch sensor chip. I am going to talk to them using SPI, and I think I have come up with an idea on how to control up to 256 chips, that are each on there own board (256 chips, 256 PCBs)

My idea is to use buffers for the output of each board, and to use a digital comparator to control each Chip Select of each chip.

I want to ask others if this idea would work before I spend the money to get parts. Or if anyone would have a better idea. I included a quick design, please ignore that there is no pullu ps/pull downs, or that the enables are floating. It was just a quick design, just to show my idea.

Thanks
TC

637 x 692 - 86K
«1

Comments

  • tonyp12tonyp12 Posts: 1,951
    edited 2016-08-31 15:08
    How far away are each board?, 1MHz spi don't like to travel more than 30cm, slow it dow to 250KHz and maybe a meter
    How many mcu/prop pins do you want maximum to be used?
    16pins for data, reading 16 spi boards at the same time,
    1 pin for clock fanned out.

    maybe using i2c 4bit expanders for ChipSelect, they often have 3 pin for address.
    And you could use 74hc 3-to-8 decoder after that.

    So 16*8*8 = 1024

    Should use the chips i2c mode in the first place, plenty of i2c fanout and extension ic's is out there.
  • TCTC Posts: 1,019
    tonyp12 wrote: »
    How far away are each board?, 1MHz spi don't like to travel more than 30cm, slow it dow to 250KHz and maybe a meter
    How many mcu/prop pins do you want maximum to be used?
    16pins for data, reading 16 spi boards at the same time,
    1 pin for clock fanned out.

    maybe using i2c 4bit expanders for ChipSelect, they often have 3 pin for address.
    And you could use 74hc 3-to-8 decoder after that.

    So 16*8*8 = 1024

    I try to use i2c cap-sence IC's in the first place.

    Thanks Tony,

    The chip is I2C, but it only allows 5 different addresses. Way to little for 1000 touch sensors. That was my first choose.

    At this point it is not clear how far each chip will be from each other, but I dont really see more than a meter away. That is why I was thinking buffers might help if each chip was a meter away. I was thinking of using parallel printer cables to connect between each board.

    The only other thing hooked to the prop is an SD card, and left/right audio out. So including the standard prop pins, I would be using 10 pins, the rest is open game.

    I do like the idea of using a I2C expander though. Might look into it more.

    I do want to make these somewhat universal, and convertible. At this point we do not know if one prop would manage all 1000 sensors, and play the audio. Or if we will have to use a handful of props, with each of them reading some of the sensors and playing its own audio. It depends on how large (size) this art project ends up being.

    TC
  • tonyp12tonyp12 Posts: 1,951
    edited 2016-08-31 15:50
    There are 16 to 64channel too:
    http://www.mouser.com/Sensors/Capacitive-Touch-Sensors/_/N-1b8oy?P=1yzvta4Z1yx7npqZ1ypwvr6Z1yx7p5oZ1yx7nm1Z1yx7ni6&Ns=Pricing|0

    Say you do four i2c masters on the Prop (maybe all share one clk pin)
    5-channel I2C-bus hub on each (PCA9516APW etc) 1in-4out with enables
    2bit address on each i2c slave = 4


    4*4*4*16channel= 1024


  • TCTC Posts: 1,019
    tonyp12 wrote: »
    There are 16 to 64channel too:
    http://www.mouser.com/Sensors/Capacitive-Touch-Sensors/_/N-1b8oy?P=1yzvta4Z1yx7npqZ1ypwvr6Z1yx7p5oZ1yx7nm1Z1yx7ni6&Ns=Pricing|0

    Say you do four i2c masters on the Prop (maybe all share one clk pin)
    5-channel I2C-bus hub on each (PCA9516APW etc) 1in-4out with enables
    2bit address on each i2c slave = 4


    4*4*4*16channel= 1024


    Most of those chips are only made for touch, I have to have proximity sensing. And not just an inch or so, I need about 3-4 inches distance from the touch sensor. Another reason I went with the CAP1188, is because I could get a cheap dev board from Adafruit, that would allow me to work with the chip to see if it will do what we need. And it does. I am on a small time crunch with getting a small setup working. I have about 20 days to design boards, get them made, assembled, make the code (that part I am slow at), and figure out an easy way to change settings.

    I have to follow the K.I.S.S. model for this project. Others have tried to help my friend using an Arduino, and a RaspberryPi, both could not detect a hand, and play audio reliably and consistently. I knew the prop could do this with no problem.

    TC
  • CAP1188
    mix and match to get to the goal

    7 prop i2c *4 hub switch *5 address *8channel= 1120
    20 prop i2c *5 address *8channel= 800
  • TCTC Posts: 1,019
    tonyp12 wrote: »
    CAP1188
    mix and match to get to the goal

    7 prop i2c *4 hub switch *5 address *8channel= 1120
    20 prop i2c *5 address *8channel= 800

    I like the idea. I never knew there were I2C bus switches.

    I am wondering, what is the down side to my original idea? Here is my thinking..... set 7 prop IO pins to select the chip I want using a standard binary format, and the 8th pin to enable/disable the chip. Send register address select command, then read/write. Then do all over again. And I can make up 256(max, but not really) PCBs that can be used from if I need 1 sensor, all the way up to 2048 sensors if I want.
    VAR
    
      byte  CS_address
    
    PUB
    
      repeat CS_address from 0 to whatever
    
        outa[IO0..IO7] := CS_address
    
        if Chip_enable == 1
          outa[IO7] := 1
    
        else
          outa[IO7] := 0
        
        read or write chip
    
    

    Im not questioning you option in any way, Im just trying to understand the down side to my idea.

    TC

  • tonyp12tonyp12 Posts: 1,951
    edited 2016-08-31 19:17
    cost, add up all the parts for your idea per board and then *256 it, is $2000 reasonable for your customer?
    Could get a xbox Kinect and read the hands virtually cheaper.

    Parallel wires for address on 1 meter, there is a reason why SATA is serial (sure it's differential) and parallel ide cables are gone.

  • TCTC Posts: 1,019
    This project would be out in the elements for years. He has a deal with a local park to display the project. So a Xbox Kinect would not be the best option.

    Now I understand from a cost point.

    I thought SATA used a differential pair for TX and RX to help with noise, and to increase the bandwidth. What I would really like to use is a Ethernet setup, but the cost, and the code would be insane.
  • tonyp12tonyp12 Posts: 1,951
    edited 2016-08-31 20:05
    As the chip internally have a 5 address "i2c hub", use it to bring cost and complexity down.

    Not sure what refresh rate you're looking at, If you get as many parallels bits going out from Prop, the better.
    When you have 125 units in series and need to send 24bit data, refresh rate is starting to be a problem.

    You only had one single SPI master, getting 8 of them sharing one clk-pin would use 17 Prop pins.
    A I2C version sharing one clock pin (as I hope there is no slave clock stretching) would only use 9 pins.

    spi would be faster if it can do 250KHz and I2C only 100KHz, but at the cost of pins.

    In both version you should buffer the clk-out for fanout.


    >TX and RX to help with noise, and to increase the bandwidth
    First ATA-IDE was 40wire and then they had to make it 80, just to put a ground wire between every data line.
    noise is what limit bandwidth, parallel wires may not reach destination at the same time and it's not differential, as noise should show up on both pairs and be ignored in sata
  • TCTC Posts: 1,019
    I was wondering about the refresh rate as well. When it involves the public, it is hard to say what is considered "slow". That is the main reason I am going with a stand alone chip to detect the hands. I dont have to constantly scan the 1000+ inputs to see if a hand is there. I only have to wait till the #ALERT line is triggered, then scan to see what one was touched.

    For the prop pins, I am not that concerned about using all the pins. This project will only be doing is look for a touch, then if touched play an audio file for that touch. There is going to be no displays, LEDs, motors, etc... Just the sensor communication, audio left/right, and a SD card.

    One benefit of using SPI, is if I need the bandwidth. When in 4 line SPI mode, the CAP1188 can output data at the same time data is inputting. That means, I can write to an address, and read from an different address at the same time. But it is hard to say if I really need that at all. I dont think I will ever need that kind of bandwidth.
  • When you first posted my first thought was just use a 50 cent PIC chip per sensor and put them on the same one-wire serial bus or even daisy chain them as they can all be identical and won't need an address. So send a command to the start of the chain, it sends the command and its response to the next one etc until you you receive all the responses. This can happen many times per second easily. I've been using tiny PIC12F1572s in MSOP8 packs but really anything easy to use and cheap(er).
  • A 16pin msp430gx2xx with 8 capsense, running spi that it repeats if address byte don't match would combine it in to one chip. Not sure if 3 inch is possible.
  • TCTC Posts: 1,019
    When you first posted my first thought was just use a 50 cent PIC chip per sensor and put them on the same one-wire serial bus or even daisy chain them as they can all be identical and won't need an address. So send a command to the start of the chain, it sends the command and its response to the next one etc until you you receive all the responses. This can happen many times per second easily. I've been using tiny PIC12F1572s in MSOP8 packs but really anything easy to use and cheap(er).


    I wish I had the knowledge to use a PIC, but I dont. I only know SPIN and some PBASIC(not used it in years). And with this project I just dont have the time to spend on learning a new system and/or language. If I did know how to use PIC's it would be easy. I could just use a PIC to detect proximity sensing, save the order the touch was detected (if more than one touch), and pass the data along some kind of buss (maybe CAN or something). Or even use USB to communicate the data.



    tonyp12 wrote: »
    A 16pin msp430gx2xx with 8 capsense, running spi that it repeats if address byte don't match would combine it in to one chip. Not sure if 3 inch is possible.

    I've talked with TI about this, and they could not give me a lot of options that would work with the prop, since it is the only thing I know how to program.

  • kwinnkwinn Posts: 8,697
    To me it sounds like there would be quite a bit of logic on each board, which would cost in parts and board size, so why not use a propeller chip on each board and use an RS485 or similar bus to communicate. Much simpler, more flexible, and probably less expensive.
  • TCTC Posts: 1,019
    kwinn wrote: »
    To me it sounds like there would be quite a bit of logic on each board, which would cost in parts and board size, so why not use a propeller chip on each board and use an RS485 or similar bus to communicate. Much simpler, more flexible, and probably less expensive.

    I have considered that option. But I was concerned about the prop being $8 each. What I am going to do is seeing how far the touch sensor can be before the CAP1188 can not detect a touch. I am using a shielded single conductor wire to connect between each touch sensor input, and a bare single sided PCB (as the touch area). Hopefully I can get some good amount of distant out of the setup. That way I could put 30 or so touch sensors on one board with a prop to control and monitor them.

  • tonyp12tonyp12 Posts: 1,951
    edited 2016-09-01 16:23
    I would say all those 8 channel capsence IC's are just MCU with simple factory installed firmware, but they don't act as you want it.

    Msp430 is pretty simple to get started in C, or in Energia that is even simpler than Spin.

    2 SPI with 8 touch cost 60cents at @1K: (even DIP version is avail)
    http://www.ti.com/product/msp430g2233
    http://www.ti.com/product/msp430g2203

    Step1: set 8 pins as capsence
    Step2: read them 100/sec, if variation from running average is above 10% it have sense external capacitance.
    if less that 10%, just use the new reading for the running average {pad0=(pad0*3 + readvalue)/4}, this allows for slow drifts.

    Step3: SPI1 IRQ waits for a address byte, if it does not match its own, it will repeat it out on SPI2.
    Step4: how the spi daisychain will work takes some planning as each step will create a lag.

    Not sure if distance of 3" (with big pad) is the same as your ic.

    But if you don't want to learn C on a new MCU, I would go with I2C hubs to fanout to as many you want.
    best part is you can do multicast out a setting on all IC's with that address at the same time
  • kwinnkwinn Posts: 8,697
    If you want one CAP1188 per board you might consider using a single bit flip/flop on each board, connecting them in series as a shift register, and shift a single chip select bit through each board in turn. No way to drive all 256 boards in series unless you add driver ic’s, but they could be connected in chains of 32 – 64. Single FF chips are about 0.50 cents so it does not add much cost to a board.
  • tonyp12tonyp12 Posts: 1,951
    edited 2016-09-01 22:54
    single flipflop (20cents) on each board, done as serial-in-serial-out for spi cs could be done
    https://www.ee.usyd.edu.au/tutorials/digital_tutorial/part2/register02.html

    You reset the system by setting data high, then sending numerous clock pulses *units in series.
    then low data, single clock pulse, unit1 is ready for spi communication.
    then high data,single clock pulse, unit2 is ready for spi communication.
    single clock pulse, unit3 is ready for spi communication.........................

    I would do 4 spi masters on prop, so each branch does 32 boards in series.
    put a 3bit buffer on each board for spiclk/mosi/miso, probably could get away by just doing in on every 4th board,
    but to keep all boards the same, example use NL37WZ17USG (20cents)
    or 74LVC3G34DP,125 (if above 0.50mm it to small)

  • TCTC Posts: 1,019
    edited 2016-09-02 16:06
    kwinn wrote: »
    If you want one CAP1188 per board you might consider using a single bit flip/flop on each board, connecting them in series as a shift register, and shift a single chip select bit through each board in turn. No way to drive all 256 boards in series unless you add driver ic’s, but they could be connected in chains of 32 – 64. Single FF chips are about 0.50 cents so it does not add much cost to a board.

    tonyp12 wrote: »
    single flipflop (20cents) on each board, done as serial-in-serial-out for spi cs could be done
    https://www.ee.usyd.edu.au/tutorials/digital_tutorial/part2/register02.html

    You reset the system by setting data high, then sending numerous clock pulses *units in series.
    then low data, single clock pulse, unit1 is ready for spi communication.
    then high data,single clock pulse, unit2 is ready for spi communication.
    single clock pulse, unit3 is ready for spi communication.........................

    I would do 4 spi masters on prop, so each branch does 32 boards in series.
    put a 3bit buffer on each board for spiclk/mosi/miso, probably could get away by just doing in on every 4th board,
    but to keep all boards the same, example use NL37WZ17USG (20cents)
    or 74LVC3G34DP,125 (if above 0.50mm it to small)


    I like that idea, its simple, cheap, and I can continue using the code I have made so far.

    I was planing on adding non-inverting drivers/buffers on the output of each board. I was also going to have a 3.3V regulator on each board, that way I would not have to worry about the voltage loss along the wires. I hope this is understandable.
    For example
    
      prop IO pin -->-*-->buffer--> to next board
                      |
                       -->CAP1188
    
    

    TC
  • kwinnkwinn Posts: 8,697
    TC wrote: »
    kwinn wrote: »
    If you want one CAP1188 per board you might consider using a single bit flip/flop on each board, connecting them in series as a shift register, and shift a single chip select bit through each board in turn. No way to drive all 256 boards in series unless you add driver ic’s, but they could be connected in chains of 32 – 64. Single FF chips are about 0.50 cents so it does not add much cost to a board.

    tonyp12 wrote: »
    single flipflop (20cents) on each board, done as serial-in-serial-out for spi cs could be done
    https://www.ee.usyd.edu.au/tutorials/digital_tutorial/part2/register02.html

    You reset the system by setting data high, then sending numerous clock pulses *units in series.
    then low data, single clock pulse, unit1 is ready for spi communication.
    then high data,single clock pulse, unit2 is ready for spi communication.
    single clock pulse, unit3 is ready for spi communication.........................

    I would do 4 spi masters on prop, so each branch does 32 boards in series.
    put a 3bit buffer on each board for spiclk/mosi/miso, probably could get away by just doing in on every 4th board,
    but to keep all boards the same, example use NL37WZ17USG (20cents)
    or 74LVC3G34DP,125 (if above 0.50mm it to small)


    I like that idea, its simple, cheap, and I can continue using the code I have made so far.

    I was planing on adding non-inverting drivers/buffers on the output of each board. I was also going to have a 3.3V regulator on each board, that way I would not have to worry about the voltage loss along the wires. I hope this is understandable.
    For example
    
      prop IO pin -->-*-->buffer--> to next board
                      |
                       -->CAP1188
    
    

    TC

    Basically the same as what I had in mind. The spi signals to the CAP1188 would connect to the boards in parallel in groups of 32 to 64, and the clock and data signals for the chip select flip-flops would go in to one board, be buffered, and go out to the next board.

    Don't really want to have the spi signals from the CAP1188 looping through a buffer on each board. The delay through each buffer may limit the maximum speed of the spi bus.
  • TCTC Posts: 1,019
    kwinn wrote: »

    Basically the same as what I had in mind. The spi signals to the CAP1188 would connect to the boards in parallel in groups of 32 to 64, and the clock and data signals for the chip select flip-flops would go in to one board, be buffered, and go out to the next board.

    Don't really want to have the spi signals from the CAP1188 looping through a buffer on each board. The delay through each buffer may limit the maximum speed of the spi bus.

    I did not even think of the delay through the buffer. That would add up real fast. Thanks for the help, now to get designing.

    TC

  • kwinnkwinn Posts: 8,697
    Here is a simple block diagram of what I had in mind for the serial board select registers.
    1628 x 885 - 23K
  • kwinnkwinn Posts: 8,697
    BTW, there are several ways to do the bus connections.

    The simplest would be 6 lines per 32 board branch. Straight forward coding, the fastest, but needs 24 prop pins.

    Next would be 3 lines for the sel_bus and 3 per board branch. Fewer pins (15) but somewhat slower scan speed and slightly more complex code.

    Then there is the slowest but fewest pins choice. It would require a bit of extra hardware on the propeller board but would only require four pins. Unfortunately it would also be one fourth the speed of the fastest choice.
  • TCTC Posts: 1,019
    kwinn wrote: »
    BTW, there are several ways to do the bus connections.

    The simplest would be 6 lines per 32 board branch. Straight forward coding, the fastest, but needs 24 prop pins.

    This was the exact idea I was thinking. Its so nice the prop has so many pins at my disposal. And that option also allows me to be able to use 6 controller boards (if needed) without changing much code. The picture was exactly what I was seeing when you suggested it.

    Thank you so much for all your (past and present) help.

    TC



  • kwinnkwinn Posts: 8,697
    You're welcome. That circuit idea came from my second propeller project. It had to control 12 remote slave boards, each of which in turn controlled 56 distributed actuators for a total of 672 actuators.
  • TCTC Posts: 1,019
    I was doing some research on more ideas, and came across one that I would like to get some opinions on.

    Since it is unknown at this time how long the wireing could be from the prop and the sensor chips, I was a little worried about losing data from the voltage drop on the wires, and outside noise. I would like to use a twisted pair for the data lines, but that would turn out to be very costly. Then I remembered about "current loops". Where and analog current signal is used to send information over long wires. Most industrial equipment, and auto manufacturers use it. A pair of wires have a set current flowing through them. 4ma for the low end, and 20ma for the high end. One wire is the current source, and the other is the return(ground I'm most cases).

    I figured, why could that not work for what I need? I could have a simple, cheap op-amp measuring the voltage drop across a resistor (1 Ω for example). That would give me 4mV as a low signal, and 20mV for a high signal. I could setup the op-amp so it amplifies the voltage, say x50 gain. That would make

    4ma / 1 Ω = 4mv * 50 = 200mV (low)
    20mA / 1 Ω = 20mv * 50 = 1v (high)

    And I could also make the prop monitor the loop. If there is less than 4mA on the loop, that would mean the loop is open.

    Signals coming from the prop I have figured out, but signal going to the prop I have no figured out yet. Might do something along the lines where the prop measures the voltage needed to maintain the 4mA - 20mA range, for the data in. Not sure yet, just an idea.

    What does everyone think? Could it be a good idea? I could iliminate the need for buffers, and I would not have to worry about the propagation delays with using buffers in series. All the data in(to sensor chip), clock, and reset lines could be tied together.

    I could draw up a quick schematic to help explain my idea if it is needed.

    Thanks
    TC
  • kwinnkwinn Posts: 8,697
    edited 2016-09-14 12:50
    Serial data using a current loop was very common in the past. All the teletypes used a 0 - 20 mA current loop. Not sure this would be lower cost than RS422/485, but that would depend on exactly what you have in mind. Can you post a block diagram and description of how you picture the CAP1188 boards being connected?

    Also, do you have any idea of how far apart the CAP modules will be placed.
  • TCTC Posts: 1,019
    kwinn wrote: »
    Serial data using a current loop was very common in the past. All the teletypes used a 0 - 20 mA current loop. Not sure this would be lower cost than RS422/485, but that would depend on exactly what you have in mind. Can you post a block diagram and description of how you picture the CAP1188 boards being connected?

    Also, do you have any idea of how far apart the CAP modules will be placed.

    I will have to check into RS422/RS485, so I dont know off hand the cost differences.

    I will draw up something a little later. Right now it is all hands on deck at work. So I dont have a lot of free time during the day.

    Right now, with just a single conductor wire, I can have about 4ft before the sensor chip can not calibrate. I am playing with shielded wire, and adding resisters and capacitors to the sensor inputs, to help with filtering the input. But I am still playing with that.

    TC

  • kwinnkwinn Posts: 8,697
    TC wrote: »
    kwinn wrote: »
    Serial data using a current loop was very common in the past. All the teletypes used a 0 - 20 mA current loop. Not sure this would be lower cost than RS422/485, but that would depend on exactly what you have in mind. Can you post a block diagram and description of how you picture the CAP1188 boards being connected?

    Also, do you have any idea of how far apart the CAP modules will be placed.

    I will have to check into RS422/RS485, so I dont know off hand the cost differences.

    I will draw up something a little later. Right now it is all hands on deck at work. So I dont have a lot of free time during the day.

    Right now, with just a single conductor wire, I can have about 4ft before the sensor chip can not calibrate. I am playing with shielded wire, and adding resisters and capacitors to the sensor inputs, to help with filtering the input. But I am still playing with that.

    TC

    If you mean that you are placing the touch pads at the end of a 4 foot wire coming from the CAP1188 chip then you may have a problem. The capacitive touch chips are intended to work with touch pads that are typically on the same board as the chip, or at most a few inches away. How far away from the chip did you plan to have the sensors?
  • TCTC Posts: 1,019
    kwinn wrote: »

    If you mean that you are placing the touch pads at the end of a 4 foot wire coming from the CAP1188 chip then you may have a problem. The capacitive touch chips are intended to work with touch pads that are typically on the same board as the chip, or at most a few inches away. How far away from the chip did you plan to have the sensors?

    Unfortunately, I dont have that many options to work with. My friend casted a lot of faces before he came up with the idea of making them play audio. And since they are concrete, we cant drill into them to add some form of button(could crack them). So I have to use capacitive touch in proximity mode.

    I wanted to have a sensor for each face, but that is not cost effective. It is hard to find single channel cap sensor, that can be setup for proximity. And one that can calibrate and adjust for changes in environment.

    I used the 4 foot as an example of how far I could get the touch pad away from the sensor chip. I am trying to keep the wires as short as I possibly can.

    TC

Sign In or Register to comment.