ADS129x and bcm2835 library and Raspberry Pi 4

This time I would use the same library as previously (bcm2835) and Raspberry Pi 4 with Raspbian GNU/Linux 11 (bullseye). 

Wiring is kept the same as for RPi3 (pin compatibility between Pi3 and Pi4, hurra!).

  System preparation

After system being installed and updated and upgraded I installed bcm2835 library. 

To do so, in terminal type:

cd ~ 
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz 
tar xvfz bcm2835-1.71.tar.gz 
cd bcm2835-1.71 
./configure
make 

After some time all things were installed. 
Now, it is fine to use scripts from RPi3, anyway to do so they have to be re-compiled and re-built. 
Easy, run Geany, open source codes, compile, build, etc... 
Do not forget: when compiling and building project consisting of many files, those of .c extensions have to be re-compiled too.
Ok, you probably realised now, that it would be easier if we setup Geany. 

Geany setup

Start Geany, go to menu Build -> Set build command and modify lines there to look like below: 
Compile: gcc -Wall -c "%f" -lbcm2835 
Build: gcc -Wall -o "%e" "%f" -lbcm2835 
Execute: sudo "./"e" 

Before anything else is installed, I do recommend upgrading pip installer:

python -m pip install --upgrade pip
pip --version

To do live plot I have used pyqtgraph, and this was missing, so another install:

pip3 install pyqtgraph

After some tinkering I have found that newer version of pyqtgraph requires PyQt in version higher than 5-5.11, so tried to upgrade it, and met sooo many obstacles. Forunately stackoverflow helps here. Do this:

sudo apt-get install qtbase5-dev

Make yourself a big coffee, as next steps may take up to 2 hours, and in terminal type:

pip install pyqt5

there was also option to do so with -verbose flag, to see if anything is happening, but I done my experience without it.

Now, this is enough to do data capture and plot.

Extras

I have found this tool, named 'Trend'. Unfortunately it seems to be discontinued, so it displays with some 'history'. 
To install:

sudo apt-get install trend

What you do is run your program, when output is just printed to stdout with regular fflush, like that (in ads source):

printf(voltvalue\n);
fflush(stdout);

and in terminal:

sudo ./ads | trend -A f0f0f0 -I ff0000 -E 0 -s -1200 600

Because of lacking any better manual and troubles of historic plot removal I want to use OpenGL plotting tool. Pseudo-manual for hardcore people:

Let me know if you found how to remove this 'history plot'.

Comments

Popular posts from this blog

Hello world with ADS1298

matplotlib and Raspberry Pi 3 - show my 'Hello world!'

Data collection from ADS1298