Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6acdc6c7f8 | |||
| a23507b2ca | |||
| 6e2882dc8d | |||
| af084ea33f | |||
| 6cc457c958 |
@@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2026 gballan.
|
Copyright (c) 2026 Bit Goblin.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,43 @@
|
|||||||
# Pico Weather
|
# Pico Weather
|
||||||
|
|
||||||

|

|
||||||
|

|
||||||
|
|
||||||
Raspberry Pi Pico app to read BME280 sensor data and send it to Home Assistant.
|
Raspberry Pi Pico app to read BME280 sensor data and send it to Home Assistant.
|
||||||
|
|
||||||
Made in Go with [TinyGo](https://tinygo.org/).
|
Made in Go with [TinyGo](https://tinygo.org/).
|
||||||
|
|
||||||
## Requirements
|
## Hardware
|
||||||
|
|
||||||
|
The following hardware is what I used for a deployment:
|
||||||
|
|
||||||
|
* Raspberry Pi Pico 2 W: https://www.amazon.com/dp/B0DRJXPPWL
|
||||||
|
* The **W** is VERY important, as without networking it can't reach Home Assistant!
|
||||||
|
* Also a Raspberry Pi Pico W *should* work too, but I haven't tested it yet
|
||||||
|
* Waveshare Bosch BME280 sensor: https://www.amazon.com/dp/B07Q47DFXS
|
||||||
|
* Elegoo SSD1306 LCD: https://www.amazon.com/dp/B0FSRQG23K
|
||||||
|
|
||||||
|
Most (or all?) of these components can be swapped for equivalent components. You just need to make sure the code is compatible with whatever board you choose (not likely), is a genuine BME280 sensor, and an SSD1306 display.
|
||||||
|
|
||||||
|
Support for other hardware types may come in the future, but if there's a specific sensor or board you're in submit an issue or pull request!
|
||||||
|
|
||||||
|
### Prototyping
|
||||||
|
|
||||||
|
To help with debugging/testing deployments, I also used these components:
|
||||||
|
|
||||||
|
* Elegoo 400-pin Breadboard: https://www.amazon.com/dp/B01EV640I6
|
||||||
|
* Freenove Raspberry Pi Pico Breakout Board: https://www.amazon.com/dp/B0BFB53Y2N
|
||||||
|
* Elegoo 20cm Jumper Cables 120 count: https://www.amazon.com/dp/B01EV70C78
|
||||||
|
|
||||||
|
## Software Deployment
|
||||||
|
|
||||||
|
### Requirements
|
||||||
|
|
||||||
* [TinyGo](https://tinygo.org/getting-started/install/) - TinyGo installation guide
|
* [TinyGo](https://tinygo.org/getting-started/install/) - TinyGo installation guide
|
||||||
|
|
||||||
## Deployment
|
### Steps
|
||||||
|
|
||||||
1. Clone this git repository `git clone https://git.metaunix.net/gballan/pico-weather`.
|
1. Clone this git repository `git clone https://git.metaunix.net/BitGoblin/pico-weather`.
|
||||||
2. Copy `config.go.example` to `config.go` and modify the values to match your environment.
|
2. Copy `config.go.example` to `config.go` and modify the values to match your environment.
|
||||||
3. Hold down the **BOOTSEL** button on your Raspberry Pi Pico 2W.
|
3. Hold down the **BOOTSEL** button on your Raspberry Pi Pico 2W.
|
||||||
4. Plug in your Pico to a USB port on your PC.
|
4. Plug in your Pico to a USB port on your PC.
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ const (
|
|||||||
WifiSSID = "My Wifi Name"
|
WifiSSID = "My Wifi Name"
|
||||||
WifiPass = "SecretWifiPassword"
|
WifiPass = "SecretWifiPassword"
|
||||||
|
|
||||||
|
// Networking settings
|
||||||
|
Hostname = "pico2w-bme280"
|
||||||
|
EnableICMP = true
|
||||||
|
|
||||||
MQTTHost = "192.168.1.50" // Must be an IP address; DNS resolution is not supported currently
|
MQTTHost = "192.168.1.50" // Must be an IP address; DNS resolution is not supported currently
|
||||||
MQTTPort = "1883"
|
MQTTPort = "1883"
|
||||||
MQTTUser = "" // Leave empty if not required
|
MQTTUser = "" // Leave empty if not required
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module git.metaunix.net/gballan/pico-weather
|
module git.metaunix.net/BitGoblin/pico-weather
|
||||||
|
|
||||||
go 1.25.2
|
go 1.25.2
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -115,16 +115,20 @@ func InitNetwork(ssid, pass string) (*NetworkStack, error) {
|
|||||||
|
|
||||||
stack := &xnet.StackAsync{}
|
stack := &xnet.StackAsync{}
|
||||||
err = stack.Reset(xnet.StackConfig{
|
err = stack.Reset(xnet.StackConfig{
|
||||||
Hostname: "pico2w-bme280",
|
Hostname: Hostname,
|
||||||
RandSeed: time.Now().UnixNano(),
|
RandSeed: time.Now().UnixNano(),
|
||||||
MaxActiveTCPPorts: 2,
|
MaxActiveTCPPorts: 2,
|
||||||
MTU: uint16(framelen - ethernet.MaxOverheadSize),
|
MTU: uint16(framelen - ethernet.MaxOverheadSize),
|
||||||
HardwareAddress: hwaddr,
|
HardwareAddress: hwaddr,
|
||||||
|
ICMPQueueLimit: 4,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("stack config reset: %w", err)
|
return nil, fmt.Errorf("stack config reset: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable network pings if configured
|
||||||
|
_ = stack.EnableICMP(EnableICMP)
|
||||||
|
|
||||||
// Start background frame pump
|
// Start background frame pump
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
go stackLoop(ctx, stack, adapter)
|
go stackLoop(ctx, stack, adapter)
|
||||||
|
|||||||
Reference in New Issue
Block a user