How To Measure Meshtastic Device Power Consumption
Before you can calculate what size solar panel and battery bank are required you need to determine how much power your device consumes. This is an essential and first step in building a solar powered anything.
Setup and Requirements
To measure the average power consumption of a radio device, like a Meshtastic node, requires some hardware and some understanding.
Power Meter
You need a way to measure power. This could be a bench power supply with voltage and amperage readings. It could be a dedicated device like a USB power meter or something else. Most important is that you need to read either volts and amps OR watts over time (over time means it needs to keep track of power used over time, not just instantaneous readings). Also consider if your meter has the resolution to measure as low as you need it to. For example, some nodes consume 0.005A at 5v. Can your power meter measure and display results that small? The important part here is that your meter needs to keep track of amp hours or watt hours. A normal multimeter won't track this.
What Are We Measuring?
A watt is the unit used to measure power. Use this unit to express how much power your device consumes. If you measure volts and amps you get watts. It's an easy equation. Just multiply volts times amps to get watts: 5v x 50mA = 250mW (also described as 5v x 0.05A = 0.25W). 250mW is a measure of consumed power at a specific instance. Technically, it describes the power consumed over one hour. We can't use this number because radio devices like Meshtastic spend a lot of time receiving and only some time transmitting (transmitting consumes a lot more power than receiving). If we measure power when the device is receiving and we say that's how much it consumes in an hour we are not accounting for the less frequent but more power hungry transmissions. We need to get an average over time. To measure power over time we use watt hours. For example, if your device consumes 250mW for one hour and you want to know how much power it consumes in 24 hours, we express it like this: 24h * 250mW = 6000mWh. This result is expressed in milliwatt hours (it can also be expressed as: 6Wh).
Duty Cycle
Radios consume relatively little power when receiving. In contrast, they consume a lot more power when transmitting. Duty cycle is the percentage of time the radio transmits. Over a period of time how much of that time is spent transmitting? 5%? 10%? 25%? It's hard to know. It depends on your use-case. Instead of trying to run calculations of receive power vs transmit power based on datasheet numbers, you can run a simulated test and measure power consumption over a period of time. Run your power consumption test for at least 1 hour but the longer you run the test the more accurate it will be (if your test conditions are representative of real life). Consider 2-6 hours as a good test duration.
Test Conditions
Running a test is pretty simple in practice but requires some understanding of how Meshtastic operates in the background.
Background Network Activity
Meshtastic nodes transmit data at regular intervals. These data packets are not messages you might send to other people. They're like beacons; used to tell the mesh your node is operational and on the network. Your node will know if other nodes are online and where they are (for GPS-enabled nodes). These data packets are sent in the background and are required for the network to function (though some of these can be disabled or configured to transmit less often). Other nodes on the network will respond to some of these beacons with an acknowledgement of receipt. This means there is a baseline of network activity that will consume some power through receiving and transmitting regardless of the messages you manually send.
Simulated Testing
To set up a proper test you need to know or guess how much message traffic your network will have (manual messages sent from a node). Is it 5, 10, 20, or 50 messages in an hour? Only you can know this because everyone's situation is different.
If your message rate is small (like 2-5 messages per hour) it may not impact power consumption very much. The node is already regularly transmitting through background activity so this small number of additional message transmissions will have a low impact on overall power consumption. Your message rate is entirely use-case dependent and no one can tell you what your duty-cycle is. But you can guess and add margin to your calculations to ensure uptime.
Set A Low GPS Location Broadcast Interval
One way to simulate a message in Meshtastic is to increase the number of times the node sends a GPS location update. Your device does not need a GPS module to use this option. At the time of this writing, the default interval is 2 minutes for a normal node with GPS or 15 minutes for a node with a fixed position. You can decrease this interval and it will broadcast a message more frequently, thus simulating a manual message on the network. You can change this interval on the iPhone app, Android app, web app and CLI. We can use this feature to force more frequent transmissions and thus simulate message traffic. This is helpful because it's automated and doesn't require you to remember to manually send messages during the test.
Fixed Position Broadcast Interval
Most solar base stations don't have a GPS module because it doesn't change location and GPS consumes a lot of power. In Meshtastic you can manually set the GPS coordinates for any node. This is common for solar nodes. When a node has a fixed position it will send out that position update every 15 minutes (by default). That's a baseline of 4 GPS location updates per hour. If you want to simulate 16 messsage transmissions per hour you can set this interval to 3 minutes. That will send an update every 3 minutes which is 20 updates in total. Subtract the baseline 4 updates (that will be present after your test, when deployed) and you get 16 "messages" per hour. For 56 simluated messages per hour you would set this interval to 1 minute.
Example Test Condition With Node Settings
Tests will require at least 2 nodes. The node you measure power from and one other. Though, it may be more realistic to include 3 or 4 nodes on the network. The goal is to be as close to your final deployment network size when measuring power consumption. These test conditions would simulate a "chatty" network:
- 3 nodes on the network.
- 1 "other" node set to broadcast location every 60 seconds (disable smart location).
- Test node is paired with phone over Bluetooth.
- Test node has a fixed GPS position.
- Test node is set to broadcast location every 60 seconds (disable smart location).
Configure all your devices as indicated. It may be helpful to start the test on the hour or on a 15 minute interval (like 2:15). Write the start time on a sticky note and put it next to the test node. When you stop the test try to do it on the hour or at the 15 minute interval. This makes calculating the results easier. Make sure to reset any previous power measurements on your power meter before starting. Run the test and record the stop time and the total power consumed during the test.
Results
Your results will hopefully be listed in watt hours. Just divide the recorded watt hours by the number of hours for your test to achieve your average power rating in watt hours or miliwatt hours. Save this result and continue to calculating solar panel size.
If your meter measures amp hours you need to convert it.
Convert Amp Hours To Watt Hours
Take your total amp hour result and multiply it by the volts used for the test. For example, your test ran for 3 hours at 5.1v and your meter reads 142mAh. That's 5.1v * 142mAh = 724.2mWh. Now divide the total by the test duration: 724.2mWh / 3h = 241.4mW. This example shows an average power consumption of 241.1mW. Save your test result for the next step, calculating solar panel size.