Comments (5)
I expect that when I connect the 3.3V rail to pin 5 on the MCP3008, the value that the Pi logs should be 1023, right?
Correct, but not with the test program posted above. The test program above is for channel 0 (pin 1). For channel 4 (pin 5) it should be:
const sensor = mcpadc.open(4, {speedHz: 20000}, err => {
rather than:
const sensor = mcpadc.open(0, {speedHz: 20000}, err => {
One thing that I don't understand is that the Pi doesn't throw an error when I disconnect the MCP from it. I'd have thought that if it couldn't communicate with the MCP it would throw an error?
With SPI, if no device is connected everything still appears to work. In this case, the Linux SPI driver still reads from the SPI MISO line and every bit read is typically 0.
Do you have any suggestions about what steps I could take to troubleshoot it?
The code posted looks correct. The Linus SPI driver doesn't appear to see the MCP3008.
- Are you sure that the MCP3008 that you are using functions correctly?
- Please post the complete contents of the file
/boot/config.txt
. - Please post the output of the command
node -v
- Please post the output of the command
uname -a
- Please post the output of the command
ls -l /dev/spi*
from mcp-spi-adc.
The test program above is for channel 0 (pin 1). For channel 4 (pin 5) it should be:
Right - I changed it to channel 0, but I did try connecting 3.3V to each of the input pins one by one in case I had specified it incorrectly. But none of the pins produced any output other than 0.
With SPI, if no device is connected everything still appears to work
Ah OK.
Are you sure that the MCP3008 that you are using functions correctly?
Yes, but I don't know how to test it. I bought 4 of them and this one is fresh out of the box. I tried it with a second new one as well just in case it was faulty, but not difference.
Please post the output of the command node -v
Please post the output of the command uname -a
Please post the output of the command ls -l /dev/spi*
Here you are:
from mcp-spi-adc.
Oh yeah one more thing you asked for:
config.txt
from mcp-spi-adc.
Ahhhh... Hey Brian, I got it working!
I hadn't realised that your Raspberry Pi has a different pinout pattern from mine. I traced each cable and checked the name of the pin and discovered that the pattern was different. So I had the connections going to the wrong pins on my Pi (which is a model 4). So I just had to look up each pin by name, find it on the Pi and connect to the right pins.
I hope I didn't waste your time, although just going through your list made me think of checking that so you did help a lot!
Problem solved. Your module is awesome, thanks for making it.
from mcp-spi-adc.
If you check the pin numbers on the Pi 4 and Pi 1 GPIO headers you'll see that they are the same. Anyway, good to hear that it's working now.
from mcp-spi-adc.
Related Issues (16)
- Typescript interface?
- Error: ENOENT, No such file or directory HOT 7
- No signal from Pulse Sensor HOT 22
- bindings.js: 202 Uncaught TypeError: exists is not a function HOT 2
- support for MCP3201 HOT 1
- MCP3208 differential mode HOT 1
- Error Message HOT 3
- Incompatibility with electron because of non-context-aware-ness
- Error: EPERM, device closed, operation not permitted HOT 7
- Promises api HOT 1
- Drop support for Node.js v0.10, v0.12, v5 and v7 HOT 1
- Support for TI ADS1256 HOT 3
- Moisture sensor returns data between 0.78 (dry) and 0.54 (wet) HOT 1
- What's the different between device number and bus number? HOT 1
- Max sampling rate? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mcp-spi-adc.