MCP23008 gone bad?

G’Day folks!

As I’m sure Ryan and Travis will recall, many months ago I set up a system for remote control of a well pump. It uses NCD’s MCP23008 PCBs and Particle Electrons. It has been working reliably ever since I was able, with excellent and timely assistance from both Ryan and Travis, to get it up and running. Well, it was running perfectly until yesterday.

I received an email, via IFTTT, that the pump had been running for more than two hours when it normally takes only about 90 minutes to fill the storage tank after a float switch first calls for water. Investigation showed that the pump is not running even though the Electron reports that it is. The NCD board has power and it, in turn, is powering the Electron, but the red R1 LED on the NCD board is not on (always used to be when things were behaving normally and the pump was running). I have rebooted the board several times with no change in the status. The Electron is connected to the Particle Cloud and I can access it remotely without issue and send it commands via Ryan’s ‘Pump_On-Off’ function, so I doubt that the problem is with it.

I threw a manul switch that bypasses all the electronics and powers the pump directly and the pump came on, proving that there is nothing awry with the pump itself.

With the above background, can anyone advise if the MCP2008 is most likely dead and in need of replacement? Or might there be another explanation or fix?

Many thanks for whatever advice and counsel anyone can offer.

Good to hear from you again. I hope you are doing well.

I would concur that the relay board(MCP23008) itself sounds like the culprit.

That R1 LED is the relay status LED, it should be on when the relay is on. There should also be a Power LED on the board, is it on?

Can you hear the relay click when you call the Pump_On-Off function? If not then the relay is not actually turning on and off which means the MCP23008 chip is probably not working. That chip can be damaged from power surges or high induction coming back from the load.

We will repair the board under warranty if you want to ship it here for repair. You can start that RMA process here:
That said given the low cost of the board itself and the fact this system needs to stay online it would not be a bad idea to have a spare board around just in case. Many users will keep a spare board on hand in case something goes wrong then they can swap the board out and send the damaged board in for repair, this way they always have a good board on hand. Just a thought.

Hi there Travis!

Yes, the power LED is on. I will drive to the site shortly and listen for the click.

I fully agree with you that a spare board is a good idea. The powers that be declined that suggestion when I first made it to them months ago. I’m sure that they will have a different perspective now!

I was wandering around your website yesterday trying to find the exact same unit. The item I found that appeared to be the same now has more than doubled in price (to $103.95), along with the comment that the order interval is now lengthy (see attached). Am I looking at the right item?

Is your board a solid state relay board? From what I can tell on your order history it looks like you have 2 channel relay boards like this one:

Yup, that’s it. But here’s a freakin’ mystery: as you requested, I went to the site and called the ‘Pump_On_Off’ function (“on”) from my iPhone and IT WORKED!! Not only an audible click from the relay, but the R1 LED came on and the ‘Pump_Status’ variable returned a ‘1’. I then called ‘Pump_On_Off’ again (“off”) and the relay clicked, the R1 LED turned off and the ‘Pump_Status’ variable returned a ‘0’. So everything is now working exactly as it should!

WTF? I did all of that over the weekend, multiple times, including a complete reset by removing all power. I also tried the ‘Pump_Minutes’ function to turn the pump on for a specified number of minutes. The Electron would always return the expected results and the Google sheet that maintains, via IFTTT, a log of all ‘on’ and ‘off’ events was correctly logging everything, but the R1 relay never operated.

How could something that was broken suddenly fix itself? About the only thing that has changed around here is the temperature. Over the weekend it was in the mid to high 80s (maybe higher in the electronics enclosure). Right now it is about 78. Could temperature have anything to do with this very strange behavior?

Hey Travis, are you still there? Way back last July I had a problem, discussed above, with one of our MCP23008 relay boards and I intended to order a backup unit. I then forgot to do so, of course. Can I do so now, i.e. are those boards still available? I can’t find it on your website. If they are still available, please let me know how an order should be placed these days. If they are not available, what are my options?

Disregard; I found it!! Ordering now.

Great. Please let us know if you need anything else.

Well, wouldn’t you know, there is something else…

Ryan Fontaine has suggested that NCD’s AMS5812 pressure sensor might be the gizmoidal that I can use to measure the water level in our community’s water storage tank. But I have no idea whatsoever how to install it and connect it to my MCP23008 and its associated Particle Electron. Can you help or direct me to some resource that can?

Oops; I just found the connection diagram. No need to respond until I review all the stuff on line. If my questions aren’t answered there, I’ll come back here.

OK Travis, I think I’ve got the electrical connection clarified: just plug the thing into the MCP23008’s 12C port, right? Since I am measuring water level in a tank, I need a version of the AMS5812 that is 'absolute", not ‘differential’, right? Since my tank is about 5 feet deep, I would need a version that measures up to at least 15 psi, right (2.31 psi per foot)? That all dictates model AMS5812-0150-A, right? Or might a AMS5812-0300-A be a better bet?

What I do not yet understand is how a measurement can be taken at the bottom of the tank. Clearly, the AMS5812 can’t be submerged. I assume there will be a connection via vinyl tubing to something underwater, but what, exactly? Can you help me understand that?

Oops again! I got it backwards. It’s not 2.31 psi per foot but 2.31 feet per psi. Duh! So at 5 feet, I need a device that can measure 2.16 psi. However, I don’t see an ‘absolute’ version that has a maximum pressure of less than 15 psi. So will the latter still serve my needs?


I’m going to tag in @Anil_Bhaskar and @rfontaine here. I believe both of them have more experience with this than I do.

My assumption would be that you would need to run the vinyl tube from the sensor down into the tank so the end of it is at the bottom. The only alternative would be drilling a hole in the bottom of the tank and somehow attaching the tube to that hole which I wouldn’t think would be ideal. I would think it would be sufficient to just run the tube from the top of the tank down to the bottom and you could read the pressure that way(I might be wrong about that).

I’m also not 100% on absolute of differential since I’ve never worked with these. I’ll leave this recommendation up to Bhaskar and Ryan as well.

You hopefully have 1/4" threads somewhere near the tank outlet.
For the AMS sensor, I like to use a brass bushing adapter to get to 1/8" threads, then a connection such as this.

You will need to prevent freezing in the tubing.

You want a bidirectional differential sensor, not absolute.
I have a post somewhere in this forum with a detailed explanation.

But I believe NCD now has an external I2C sensor product line that would also work (similar to the Dwyer I referenced in another thread, but it operates at 3V3 supply).

If you wanted to leave the Tank Probes as the primary control, you can install a Dwyer, etc, at the Well site as a secondary control… assuming the water main is connected to the tank outlet (no fill pipe going to top of tank). So if your Tank and Well lost communication, the Well’s Electron could operate autonomously in failsafe mode.

1 Like

Terrific Ryan. Yet another thank you!

Let’s see if have this right:

The AMS sensor will be located in my existing weatherproof cabinet and connected to my NCD MCP23008 via the latter’s 12C interface. I’ll run teflon tubing from the AMS to one of the fittings you have pointed me to on Amazon. That fitting, in turn, will be connected via 1/8" threads (a 1/8" to 1/4" adapter may be required) to the outlet pipe (or maybe just set it at the bottom of the tank if I can find/create a watertight way to get it inside it).

Do I have it correct?

Additional questions: I just took a quick look on Amazon for teflon tubing and so far have not found any length greater than about 5 feet. The distance from my electronics enclosure to the tank’s outlet is probably about 25 or 30 feet. Can I join multiple sections of tubing via in-line connectors? Will the total length be a problem? Would in-line junctions introduce too much of a risk of pressure loss? And lastly, why do I need to be concerned by freezing; there will only be air in the tubing above ground, right?

I will search for your other post that you mentioned.

Oops; just found this:


  • But you will want to purge the air from the sense line. That’s why you’ll need freeze protection or use an oil pot.

  • Only (1) of the (2) AMS ports is rated for fluid service. The other port should remain open to the atmosphere, which allows the differential AMS to automatically correct the readings for barometric changes (weather patterns).

  • The length of sense line (tubing) won’t matter for practical purposes… since you are measuring a static pressure from your tank. The water in the tubing will only experience a headloss when the fluid moves along the “pipe” (IE: discharging, which you wont be doing).

For the tubing, I believe this is what I used for my last AMS:

Ah HA! I was thinking that the hose would have air in it which would be pressurized by the sensor under water. Rather, the tube will have water in it, right? So, of course, I now understand the need for freeze protection. Will 100% plain old antifreeze work?

And yes, I did see that only port 2 on the AMS is for fluids.

About to purchase all the piece parts!

No sir. This is potable water.

Hmmm. Now I AM confused. I thought there was no water passage through the pneumatic sensor attached to the tank’s outlet pipe, i.e. I thought it had some kind of diaphragm inside it that applies pressure to the fluid in the tube as a function of height of the water in the tank and thus isolates the two sides. If there is no flexible diaphragm, what does it do?

I’m at a standstill here Ryan (and Travis). I have received both the AMS5812 module from NCD and the pneumatic connector quick fittings from Amazon. I have ordered 10 meters of 2 mm (I.D.) tubing. But I still do not understand how this whole water level thing needs to be hooked up.

I really hate bugging you guys with all my questions, but I am not a mechanical engineer (or any other kind of engineer for that matter). But I do try to think logically and I just don’t see how a pressure sensor mounted higher than the high-water level in my storage tank is able to detect a change in level therein (if the 5812 is below the low-water mark, that would make sense to me).

Assuming that it can function above the high-water mark, does that mean that I should initially connect the tube to the tank when the latter is full or when it is empty? Even if I fill the tube with water before connecting it to the 5812, won’t there be a little air in the 5812’s metal P2 port and won’t that affect its readings? And how can I prevent the water in the tube from feezing when it’s below 32°?

Or am I wrong and the tube should be filled with air, not water?

I have searched all over the web and I have found all kinds of technical documentation - specifications, white papers, etc, - about the 5812. I’ve seen all kinds of discussions about programming for the thing, including YouTube videos by someone with such a strong Indian accent that I can’t understand him. I’ve had an email exchange with Dr. Henrick Schoepe at Analog Microelectronics in Germany, the manufacturer of the 5812. Yet I have not found a single syllable or image that explains how to physically hook up a system.

If you can help me get to the point of becoming functional, I will write something up that thoroughly documents the project for the benefit of others. Maybe even a YouTube video.

Either method would work, but the best choice is to have the AMS lower than your expected water level. That allows the sense tube to be void of air.

The AMS will report the head/pressure of water referenced from the Elevation of the AMS.
IE: if the AMS is actually installed 1’ higher than the Elevation of the bottom of the tank, you would add 1’ to the reading to calculate the water level in the ground tank.

1 Like