Main repository to develop and test drivers for various micro controllers and devices. The aim is to make each generic enough to be used in any C based project. Future plans for the project include:
- Statistical fusion of multiple sensors.
- Direct communication using a PS/2 Keyboard. (This will use the built COM_PROTOCOL framework)
- Direct communication using a USB2.0 Keyboard. (This will use the built COM_PROTOCOL framework)
- Generic UART serial communication to send data out for external analysis. (This will use the built COM_PROTOCOL framework)
- Incremental sample storage using the eeprom drivers.
- Sending live status of the sensors to an external device via the WIFI adapter. (Will need to see if this can be built into COM_PROTOCOL, or only separate)
- Perform meteorological calculations. (Exact definitions and explination will follow in the WEATHER section)
Examples of usage is written for the PICO-SDK.
The following are good resources to help out: PICO-SDK documents: https://raspberrypi.github.io/pico-sdk-doxygen/index.html
The following drivers have been made:
- BMP-180: Data-Sheet -> https://cdn-shop.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf
- 24LC16B: Data-Sheet -> https://pdf1.alldatasheet.com/datasheet-pdf/view/515802/MICROCHIP/24LC16B.html
- BME-280: Data-Sheet -> https://cdn-shop.adafruit.com/datasheets/BST-BME280_DS001-10.pdf
Breakout Board -> https://www.mouser.com/datasheet/2/737/adafruit-bme280-humidity-barometric-pressure-tempe-740823.pdf
It is important to install the cmake and c/c++ config extentions for vscode. A good help guide video can be found at https://www.youtube.com/watch?v=B5rQSoOmR5w
For PICO-SDK usage in vscode it is important to have the following defined in your .bashrc config file:
- export PICO_SDK_PATH=/PATH/TO/pico-sdk
- export PICO_EXAMPLES_PATH=/PATH/TO/pico-examples
- export PICO_EXTRAS_PATH=/PATH/TO/pico-extras
- export PICO_PLAYGROUND_PATH=/PATH/TO/pico-playground
If you did that then you should be able to use the onboard Cmake file.
If one is only interested in using the drivers keep the following in mind:
- Add any board specific I2C implementations to the corresponding device's *_i2c.h header implementation files (for example bmp180_i2c.c).
- Add any board specific I2C initialization functions and values to i2c_config.c and i2c_config.h.
- main.h shows the structure that need to be declared in order to start using the drivers, further they always need to be initialized.
- The drivers are a package deal. As such in order to use a driver you need to include its .c, .h and all i2c specific files to your project.
- Deactivate any communication protocol flags such as BMP_180_COM_PROTO_ENABLE in their respective header files. This will disable these features on compile time.
This is designed to simulate the feel of working on a linux terminal. It provides a generic way to interact with the PICO and allows one to execute functions on demand. Further documentation is provided in the header com_protocol.h.
Unlike the drivers this is PICO specific and will only work with the recommended PICO-SDK.
A tutorial to set up communications to the pico can be viewed at https://www.youtube.com/watch?v=pbWhoJdYA1s Here the author uses minicom. The command lsusb can be used to check if the pico is currently being registered. The command ls /dev/tty * will list all the communication ports. Generally the pico should list as a USB0 device. However for me it lists as /dev/ttyACM1. The tutorial also suggests turning off hardware flow control.
So far the following communication modes have been implemented:
- USB - via the tinyUSB library and enabling pico_enable_stdio_usb(${PROJECT_NAME} 1) in the CMakeLists.txt in order to overwrite the stdin methods of C.