2

So basically, I'm wanting to finally get into electronics. A little while ago I bought a few MCP3008 chips and analog pressure sensors. I've been wanting to build an compressed air system with it.

However... I want to avoid using a microcontroller.

I've done a lot of programming in the past, and I tend to like being able to debug things. So I was wondering; Is it possible to replace a clock signal with a simple button? The reason being... I want to slow down the clock so I can manually figure out how to work with the SPI. Possibly using some LED's, buttons, etc and recording the results.

I understand that buttons may need debouncing, etc... but would it work?

For the past hour or so, I've been googling around for an answer, and nothing definitive came up.

After looking at the datasheet for the MCP3008 here: https://www.adafruit.com/datasheets/MCP3008.pdf

It seems that the minimum clock low/high time is 125 nanoseconds; there's no max listed. Does this mean if I hooked up a debounced button as a clock signal, it would work fine?

Thank you in advance for any help. I apologize if I'm missing something obvious.

Crynux
  • 59
  • 1
  • 3
    Don't be silly! Use an MCU. – Leon Heller Oct 04 '15 at 17:34
  • The reason why I would like to avoid a MCU is because it seems overkill for such a project. All I would like to do is read and display air pressure using a sensor, a chip, and a display of sorts. I understand that there will need to be some 'glue' between these... but I feel a MCU is a little more glue than what should be needed. – Crynux Oct 04 '15 at 19:16
  • 2
    No, a microcontroller is exactly the glue that makes sense. Anything else would be messy, large, and difficult to change. – Olin Lathrop Oct 04 '15 at 19:37
  • 1
    Being afraid of MCU in a first step is maybe normal. It seems to be much work for a little output. But replacing protocolls with buttons or circuits gives you wide more work. If you really want to understand, how stuff work, then buy a oscilloscope and look at the signals which you send. Study datasheets and use some imagination. Furthermore with experience with MCUs you have it much easier for future projects. Imagine a world where you have to begin every counter with logic and, or etc connection. Or similar if every software even games would be programmed in assembler. Simply not useful – Sider Oct 04 '15 at 19:39
  • 2
    Honestly, while this questions contains some newbie mistakes, it does not deserve a -3. It was reasonably well formulated that two people could answer it. – Fizz Oct 04 '15 at 19:56
  • There are real merits to both arguments here, but a middle ground which may not have been explored: use an MCU, but use it in effect as **software simulated circuitry** to conduct experiments to determine the minimum clock speed which works, and potentially use it driving the pins in GPIO mode as a software-debounced pushbutton clock source and display delegate. Ultimately if you find in this way that the peripherals are "fully static" with no minimum clock or clock jitter sensitivity, then you can consider building a more primitive circuit to directly operate them that way. – Chris Stratton Oct 05 '15 at 00:41

2 Answers2

6

Page 4 of the datasheet you posted a link to. Note (3):

Because the sample cap will eventually lose charge, effective clock rates below 10 kHz can affect linearity.

It then says "Refer to Section 6.2" which is on page 22.

From that section it says that the clock rate doesn't need to be constant for conversion, but at effective clock rates lower than 10kHz the charge on the sample capacitor leaks away and the result is inaccurate.

Basically this could work, but you won't get a sensible conversion result.


I'm tempted to just say, if it is just for debugging, "Try it and see". But don't do it for anything sensible.

Tom Carpenter
  • 63,168
  • 3
  • 139
  • 196
4

Is it possible to replace a clock signal with a simple button?

Basically no. Not at the speed things needs to work here.

It seems that the minimum clock low/high time is 125 nanoseconds; there's no max listed. Does this mean if I hooked up a debounced button as a clock signal, it would work fine?

It's the other way around, you have worry about not sending fast enough with your button (besides the need to have sharp pulses).

In theory, SPI has no minimum clock speed but chips like MCP3008 do have one. There's no standard-mandated timeout on bus inactivity for SPI, unlike say on SMBus [where the standard timemout translates into a minimum 19kHz clock]. Practical matters are different. I know of memories an fancy MCUs whose SPI doesn't work below the MHz clock range. Tom actually found what the limitations are for your chip (+1).

For tips on debugging SPI on the cheap, you could probably look at Best tools to debug simple digital circuits? and Beginner's logic analyzer?

Finally regarding

The reason why I would like to avoid a MCU is because it seems overkill for such a project. All I would like to do is read and display air pressure using a sensor, a chip, and a display of sorts. I understand that there will need to be some 'glue' between these... but I feel a MCU is a little more glue than what should be needed.

Well, you bought the wrong chips (MCP3008) for that route. Assuming your analog pressure sensors output their measurement as voltage, a chip like ICL7107 would be a direct interface between an analog sensor like that and a display. Basically to avoid the MCU you want an A/D converter with a built-in display interface.

We even have a nice, detailed answer here comparing the relative complexities of a MCU/arduino-based and ICL7107 (ASIC-based) solutions: https://electronics.stackexchange.com/a/66580/54580

Fizz
  • 14,355
  • 2
  • 43
  • 97