Additional A/D Channels Needed for Pyboard

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
JimTal001
Posts: 176
Joined: Thu Jul 30, 2015 4:59 pm

Additional A/D Channels Needed for Pyboard

Post by JimTal001 » Tue May 24, 2016 8:39 pm

I've been using the pyboard to collect and log data for 10 analog sensor, but now I need to increase the sensor count to around 30. Yes, that is a lot. Assuming all analog pin on the pyboard are occupied, what low cost alternatives exist for adding 20 analog input?
The MPC3008 chip will work if I can find a reliable way to multiplex them. The ADS1115 from Adafruit will give me all 20 channel with 5 separate board. The ADS1115 is expensive and takes a lot of space. Any suggestion or feedback would be appreciated?

Thanks
Jim

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Additional A/D Channels Needed for Pyboard

Post by dhylands » Tue May 24, 2016 10:37 pm

It looks like the MCP3008 has a chip select pin. So you should be able to connect DOUT/DIN/CLK in parallel from multiple chips and just activate the CS pin for the chip you want to talk to.

JimTal001
Posts: 176
Joined: Thu Jul 30, 2015 4:59 pm

Re: Additional A/D Channels Needed for Pyboard

Post by JimTal001 » Wed May 25, 2016 2:15 pm

It looks like the MCP3008 has a chip select pin. So you should be able to connect DOUT/DIN/CLK in parallel from multiple chips and just activate the CS pin for the chip you want to talk to.
Please correct me if I'm wrong, but as per my understanding it is not possible to use a standard GPIO pin to replace the CS pin due to precise timing requirements of the SPI protocol (using SPI_1 or SPI_2). Since I need 4 MCP3008 chip, it would require 4 GPIO pin for the CS signal.

Thanks

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Additional A/D Channels Needed for Pyboard

Post by dhylands » Wed May 25, 2016 5:24 pm

I don't understand your comment about precise timing.

The only timing constraint (from the datasheet) I could find was called Tsucs which needs to be a minimum of 100 nsec. No maxium is specified (which is what I expected).

So you should be able to use GPIO to control the CS of the chip you want to talk to and then use SPI to talk to the chip. The chip select line can be active for any old amount of time before the SPI commands are sent. In designs with a single MCP3008, it wouldn't be unheard of to tie the chip select line permanently to ground.

JimTal001
Posts: 176
Joined: Thu Jul 30, 2015 4:59 pm

Re: Additional A/D Channels Needed for Pyboard

Post by JimTal001 » Wed May 25, 2016 9:24 pm

I found this board at sparkfun: https://www.sparkfun.com/products/9056
More info here: http://bildr.org/2011/02/cd74hc4067-arduino/

Two of these will give me 32 Analog sensor using a total of 8 GPIO pins. Cost is low ($5 per).

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Additional A/D Channels Needed for Pyboard

Post by dhylands » Wed May 25, 2016 9:57 pm

That's a nifty chip.

Post Reply