All Projects → d2r2 → go-bsbmp

d2r2 / go-bsbmp

Licence: other
Golang library to interact with Bosch Sensortec BMP180/BMP280/BME280/BMP388 temperature, pressure and humidity sensors via I2C-bus from Raspberry PI.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to go-bsbmp

go-hd44780
Golang library to interact with liquid-crystal display driven by Hitachi HD44780 IC via I2C-bus driver from Raspberry PI.
Stars: ✭ 31 (-24.39%)
Mutual labels:  gpio, i2c, embedded-linux
Swiftygpio
A Swift library for hardware projects on Linux/ARM boards with support for GPIOs/SPI/I2C/PWM/UART/1Wire.
Stars: ✭ 1,188 (+2797.56%)
Mutual labels:  gpio, i2c
Tinygo
Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.
Stars: ✭ 9,068 (+22017.07%)
Mutual labels:  gpio, i2c
Gopi
Raspberry Pi Go Language Interface
Stars: ✭ 82 (+100%)
Mutual labels:  gpio, i2c
Rppal
A Rust library that provides access to the Raspberry Pi's GPIO, I2C, PWM, SPI and UART peripherals.
Stars: ✭ 463 (+1029.27%)
Mutual labels:  gpio, i2c
Imanager
Advantech iManager Linux driver set for Advantech Embedded Boards
Stars: ✭ 16 (-60.98%)
Mutual labels:  gpio, i2c
Johnny Five
JavaScript Robotics and IoT programming framework, developed at Bocoup.
Stars: ✭ 12,498 (+30382.93%)
Mutual labels:  gpio, i2c
pigpio-client
A nodejs client for pigpio socket interface.
Stars: ✭ 24 (-41.46%)
Mutual labels:  gpio, i2c
Periph
Go·Hardware·Lean
Stars: ✭ 1,700 (+4046.34%)
Mutual labels:  gpio, i2c
awesome-embedded-swift
⚡️🛠🧰 A curated list for Embedded and Low-Level development in the Swift programming language.
Stars: ✭ 57 (+39.02%)
Mutual labels:  gpio, i2c
Drivers
TinyGo drivers for sensors and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.
Stars: ✭ 250 (+509.76%)
Mutual labels:  gpio, i2c
Nf Interpreter
⚙️ nanoFramework Interpreter, CLR, HAL, PAL and reference target boards
Stars: ✭ 168 (+309.76%)
Mutual labels:  gpio, i2c
Cylon
JavaScript framework for robotics, drones, and the Internet of Things (IoT)
Stars: ✭ 3,862 (+9319.51%)
Mutual labels:  gpio, i2c
Raspberrysharp
A .NET/Mono IO Library for Raspberry Pi This library is a complete refactoring of Raspberry-Sharp libraries, merged into one library and updated to RB3, CM3 and RB3+
Stars: ✭ 41 (+0%)
Mutual labels:  gpio, i2c
Elixir ale
Interact with hardware in Elixir - GPIOs, I2C and SPI
Stars: ✭ 336 (+719.51%)
Mutual labels:  gpio, i2c
Mraa
Linux Library for low speed IO Communication in C with bindings for C++, Python, Node.js & Java. Supports generic io platforms, as well as Intel Edison, Intel Joule, Raspberry Pi and many more.
Stars: ✭ 1,220 (+2875.61%)
Mutual labels:  gpio, i2c
vdcd
vdcd - virtual device controller daemon/framework for digitalSTROM
Stars: ✭ 19 (-53.66%)
Mutual labels:  gpio, i2c
gobot
Golang framework for robotics, drones, and the Internet of Things (IoT)
Stars: ✭ 7,869 (+19092.68%)
Mutual labels:  gpio, i2c
Powershell Iot
Interact with I2C, SPI & GPIO devices using PowerShell Core!
Stars: ✭ 106 (+158.54%)
Mutual labels:  gpio, i2c
Ofxgpio
Library C++ for raspberrypi and orangepi, GPIO interfaces compatible with openframeworks.
Stars: ✭ 155 (+278.05%)
Mutual labels:  gpio, i2c

Bosch Sensortec BMP180, BMP280, BME280, BMP388 temperature, atmospheric pressure and humidity sensors

Build Status Go Report Card GoDoc MIT License

BMP180 (pdf reference), BMP280 (pdf reference) and BME280 (pdf reference) are populare sensors among Arduino and Raspberry PI developers. Sensors are compact and quite accurately measuring, working via i2c bus interface: image

BMP388 (pdf reference) is the next generation of the BMP280. Improved temperature coefficient, and the addition of a FIFO. Parameters measured are Temperature and Absolute Atmospheric Pressure.

Here is a library written in Go programming language for Raspberry PI and counterparts, which gives you in the output temperature and atmospheric pressure values (making all necessary i2c-bus interracting and values computing).

Golang usage

func main() {
	// Create new connection to i2c-bus on 1 line with address 0x76.
	// Use i2cdetect utility to find device address over the i2c-bus
	i2c, err := i2c.NewI2C(0x76, 1)
	if err != nil {
		log.Fatal(err)
	}
	defer i2c.Close()
	// Uncomment next line to supress verbose output
	//logger.ChangePackageLogLevel("i2c", logger.InfoLevel)

	sensor, err := bsbmp.NewBMP(bsbmp.BMP280, i2c)
	if err != nil {
		log.Fatal(err)
	}
	// Uncomment next line to supress verbose output
	//logger.ChangePackageLogLevel("bsbmp", logger.InfoLevel)

	// Read temperature in celsius degree
	t, err := sensor.ReadTemperatureC(bsbmp.ACCURACY_STANDARD)
	if err != nil {
		log.Fatal(err)
	}
	log.Printf("Temprature = %v*C\n", t)
	// Read atmospheric pressure in pascal
	p, err := sensor.ReadPressurePa(bsbmp.ACCURACY_STANDARD)
	if err != nil {
		log.Fatal(err)
	}
	log.Printf("Pressure = %v Pa\n", p)
	// Read atmospheric pressure in mmHg
	p1, err := sensor.ReadPressureMmHg(bsbmp.ACCURACY_STANDARD)
	if err != nil {
		log.Fatal(err)
	}
	log.Printf("Pressure = %v mmHg\n", p1)
	// Read atmospheric altitude in meters above sea level, if we assume
	// that pressure at see level is equal to 101325 Pa.
	a, err := sensor.ReadAltitude(bsbmp.ACCURACY_STANDARD)
	if err != nil {
		log.Fatal(err)
	}
	log.Printf("Altitude = %v m\n", a)
}

Getting help

GoDoc documentation

Installation

$ go get -u github.com/d2r2/go-bsbmp

Troubleshoting

  • How to obtain fresh Golang installation to RPi device (either any RPi clone): If your RaspberryPI golang installation taken by default from repository is outdated, you may consider to install actual golang mannualy from official Golang site. Download tar.gz file containing armv6l in the name. Follow installation instructions.

  • How to enable I2C bus on RPi device: If you employ RaspberryPI, use raspi-config utility to activate i2c-bus on the OS level. Go to "Interfaceing Options" menu, to active I2C bus. Probably you will need to reboot to load i2c kernel module. Finally you should have device like /dev/i2c-1 present in the system.

  • How to find I2C bus allocation and device address: Use i2cdetect utility in format "i2cdetect -y X", where X may vary from 0 to 5 or more, to discover address occupied by peripheral device. To install utility you should run apt install i2c-tools on debian-kind system. i2cdetect -y 1 sample output:

          0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
     00:          -- -- -- -- -- -- -- -- -- -- -- -- --
     10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
     20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
     30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
     40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
     50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
     60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
     70: -- -- -- -- -- -- 76 --    
    

Contribute authors

Contact

Please use Github issue tracker for filing bugs or feature requests.

License

Go-bsbmp is licensed under MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].