Generic software preparation
In future, there will be lot more sensors introduced than those you are working with. It will be great if you develop software that is built to use in any of your analog data acquisition projects. Preparing generic software without any errors will reduce developing time in future, and you can rapidly build projects just by adding the working generic software and calling the functions whenever needed.
We know that the MCP3008 is interfaced through the SPI protocol. To use the SPI protocol, we have to install some additional packages on our RasPi. First of all, we need to make our RasPi up to date. Enter these commands to update and upgrade the OS to the latest kernel package. If you haven't performed any update after the fresh installation, then this may take a long time. Once the process is done, restart the RasPi module to perform the normal operations:
sudo apt-get update sudo apt-get upgrade sudo reboot
After this process, we have to make the RasPi board ready...