CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Sun Dec 16, 2018 8:56 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Thu Mar 08, 2018 5:32 pm 
Offline

Joined: Thu Feb 08, 2018 5:01 pm
Posts: 17
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.


Top
   
PostPosted: Thu Mar 08, 2018 9:25 pm 
Offline

Joined: Mon Dec 13, 2010 3:02 pm
Posts: 44
Can you post your setup?
A photo or a sketch (e.g. with "Fritzing").

Gesendet von meinem LG-H870 mit Tapatalk


Top
   
PostPosted: Fri Mar 09, 2018 10:38 am 
Offline

Joined: Thu Feb 08, 2018 5:01 pm
Posts: 17
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.


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Fri Mar 09, 2018 11:57 am 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 3018
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


You do not have the required permissions to view the files attached to this post.


Last edited by Edwin Schwellinger on Sun Mar 11, 2018 7:13 pm, edited 1 time in total.

Top
   
PostPosted: Fri Mar 09, 2018 12:21 pm 
Offline

Joined: Thu Feb 08, 2018 5:01 pm
Posts: 17
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.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 5 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited