How to turn "sudo ./ads1256_test" thermocouple readouts into IF x = ... mV THEN power RPI pin x

283 views
Skip to first unread message

Luke Vos

unread,
Sep 26, 2016, 8:14:36 AM9/26/16
to bcm2835
Hi, I'm automatizing my rum brewery.

I'm trying to read 4 thermocouples attached to this expansion board on my rpi2: http://www.waveshare.com/high-precision-ad-da-board.htm

All I need is to make something that acts like:

IF thermocouple x = x Volts then power pin X on the RPI2 that will switch relays or solenoid.  

Someone told me this: 



But I can't this one figured out: 

https://pypi.python.org/pypi/PyBCM2835/ 

(Sorry I'm a beginner, this is my 1st project) 

It says: 

In order to use this extension you must build libbcm2835 as a shared object.

Example:

tar xvfz bcm2835-1.22.tar.gz cd bcm2835-1.22/src make libbcm2835.a gcc -shared bcm2835.o -o libbcm2835.so sudo cp libbcm2835.so /usr/local/lib/ sudo cp bcm2835.h /usr/local/include/

Make sure that the library path is can be found by the linker. Run ‘sudo ldconfig -v’ and if necessary, add the entry to /etc/ld.so.conf.d/libc.conf.


I'm assuming these are different commands so I have to read it as: 

tar xvfz bcm2835-1.22.tar.gz cd bcm2835-1.22/src 
make libbcm2835.a gcc -shared bcm2835.o -o libbcm2835.so 
sudo cp libbcm2835.so /usr/local/lib/ 
sudo cp bcm2835.h /usr/local/include/

When I run the 2nd line: make libbcm2835.a gcc -shared bcm2835.o -o libbcm2835.so

I get the error message: make: invalid option - - "a" 

I also ran the command in /usr/local/lib folder but same result. 

I assumed the 1.22 is replaced with the bcm2835-1.50.tar.gz version. In that src folder also same result. 

Thanks in advance, Luke

PS Do I need this one or is the Github (https://github.com/mubeta06/py-libbcm2835) actually the same? 

Izhadano

unread,
Jan 27, 2018, 5:02:11 PM1/27/18
to bcm2835
Hello Luke,

hope your project is successfull and I can learn from it. Woild you mind shearing your experience?

I'm newby to RPi, trying to use RPi3 B connected to High-Precision AD/DA Board RB-Waves-08 to read input voltages from K-type thermocouples.

I've added/unziped /bcm2835-1.45.tar.gz and High-Precision-AD-DA-Board-Code.7z packages, configured/enabled SPI,I2C,device tree for RPI3 echo “device_tree=bcm2710-rpi-3-b.dtb” >> /boot/config.txt

As result in /High-Precision-AD-DA-Board-Code/Raspberry/ADS1256 sudo ./ads1256_test show changing voltages

ID=
Ok, ASD1256 Chip ID = 0x3
0=6394EA,  6526186 ( 3.907 895 V) 
1=1EDF8F,  2023311 ( 1.211 563 V) 
2=1EE221,  2023969 ( 1.211 957 V) 
3=1EDD74,  2022772 ( 1.211 240 V) 
4=1EE294,  2024084 ( 1.212 026 V) 
5=1EDFE1,  2023393 ( 1.211 612 V) 
6=1EE18D,  2023821 ( 1.211 868 V) 
7=7FFFFF,  8388607 ( 5.023 117 V) 
My concern though that when I run again the voltages changed
pi@raspberrypi:~/High-Precision-AD-DA-Board-Code/Raspberry/ADS1256 $ su ./ads1256_test
ID=
Ok, ASD1256 Chip ID = 0x3
0=1EE42B,  2024491 ( 1.212 270 V) 
1=1EED5D,  2026845 ( 1.213 679 V) 
2=7FFFFF,  8388607 ( 5.023 117 V) 
3=792975,  7940469 ( 4.754 771 V) 
4=1EEC5A,  2026586 ( 1.213 524 V) 
5=1EECB1,  2026673 ( 1.213 576 V) 
6=1EEC0F,  2026511 ( 1.213 479 V) 
7=1ECDDE,  2018782 ( 1.208 851 V) 
pi@raspberrypi:~/High-Precision-AD-DA-Board-Code/Raspberry/ADS1256 $ su ./ads1256_test
ID=
Ok, ASD1256 Chip ID = 0x3
0=1EEBD8,  2026456 ( 1.213 446 V) 
1=1EEE42,  2027074 ( 1.213 816 V) 
2=1EED18,  2026776 ( 1.213 638 V) 
3=1EE751,  2025297 ( 1.212 752 V) 
4=7FFFFF,  8388607 ( 5.023 117 V) 
5=793201,  7942657 ( 4.756 082 V) 
6=1EEBD0,  2026448 ( 1.213 441 V) 
7=1EEB2D,  2026285 ( 1.213 344 V) 


so looks like my setup is working.


Would you kindly advice how should I connect thermocouples to RB-Waves-08 board? should I connect + of thermocouple to GND or AGND? and - of thermocouple to AD#? If I'm using 4 thermocouples should I connect all + of thermocouples to GND or AGND? Is it possible to have 4 thermocouples connected independently - no common GND? how it should be done?

How may I change the sampling time for thermocouple readings to 10 sec and save/add readings into a file? May I get DA outputs from my setup to control SSRs? How many DA outputs? or I need another board? Is python code available for this tasks? where I can find it?

Many thanks,

Igor

Luke Vos

unread,
Jan 30, 2018, 2:53:26 AM1/30/18
to bcm...@googlegroups.com, Zeeshan Ali
Hi Igor

To be honest my developer know a lot more about it. See email address attached.

I've connected all ground to AGND. Yes you should be able to run all 4 thermocouples on any of the AD1, AD2 etc 

Voltage changes: yes we struggled forever with voltage jumping out of nowhere, can't remember what we did again to solve this. Zeeshan knows I think, something to do with self-calibration. 

Hope this helps, best Luke



--
You received this message because you are subscribed to a topic in the Google Groups "bcm2835" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/bcm2835/6MfmetmLKVE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to bcm2835+unsubscribe@googlegroups.com.
To post to this group, send email to bcm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bcm2835/5e97763d-3340-49a5-a660-33801041b5f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

i.zhadanovsky

unread,
Jan 30, 2018, 10:46:51 AM1/30/18
to bcm...@googlegroups.com, Zeeshan Ali
Hi Luke,
many thanks for response and shearing your experience.

Zeeshan,
I'm trying to develope controller for my heating system - readvoltage values from   4-8  t/couple and send 1-2 output signals to SSR to control boiler and vacuum pump.
What was your approach to read t/c voltages? How reliable are they? 
Thanks,
Igor 




Reply all
Reply to author
Forward
0 new messages