MCP3008 only gives 255 or 0

eamonn
2018-03-08
2018-03-09
  • eamonn

    eamonn - 2018-03-08

    I am trying to measure temperature using a MCP3008 to convert the values. The only values I get from it are 0 or 255.
    I check the wiring a few times so I doubt that's the problem. I have setup the SPI master and MCP3008.
    It only gives 255 when the input to channel 0 is 1V higher than Vref.

     
  • Ingo

    Ingo - 2018-03-08

    Can you post your setup?
    A photo or a sketch (e.g. with "Fritzing").

    Gesendet von meinem LG-H870 mit Tapatalk

     
  • eamonn

    eamonn - 2018-03-09

    I set up the mcp3008 the same as the picture. I am using different sensors though.
    I tried testing it with a potentiometer and that's how I found out it gives 255 if the channel input is 1 volt higher than Vref and 0 if its less.
    I am using a raspberry pi 3 model B.

    IMG: Untitled.png

     
  • eschwellinger

    eschwellinger - 2018-03-09

    Hi,
    if you are working with Rasbian Stretch from 11-29-2017 Version (current Version)
    there seems a Problem with the maxSPI Speed.
    You can reduce here the SPImax Speed, then it should work. (sure depends on your used Versions of Rasbian)

    https://www.raspberrypi.org/forums/view ... 4&t=207412

    BR
    Edwin

    IMG: SPI_SPeed.jpg

     
  • eamonn

    eamonn - 2018-03-09

    Thanks for the reply.
    That seems to have fixed the problem.
    I now get a range of readings. similar to what I expected.

    Thank you.

     

Log in to post a comment.