IN219 current sensor breakout might be a option. you basically insert this where with want to measure the current, usually the power to the Rasberry pi. It connects to the PI with I2C. should meet what you want.
You can carefully split the usb power cord open cut the red wire and attach it to the board. You need a soldering iron and some hook up wire but it'...
Yes - there is a world of test instruments in the market that are capable of measuring current, voltage and time (Energy = V * I * t) consumed by a Raspberry Pi. Here's one example of such an instrument, and you can find many others by searching the Internet.
You asked about using the GPIO for this measurement. That is rather vague, and would likely be ...
Figured it out, not 100 sure on the reason but GPIO is not a valid pin to use switched to 18 and working. Also had to edited the code, updated syntax for python 3 called the function in the while block
If a GPIO set as an INPUT is not connected to a fixed voltage it is said to be floating and will randomly return 0 or 1 when tested.
In your case this shouldn't happen as it is connected to ground via the weak internal pull-down (pull_up_down=GPIO.PUD_DOWN). The internal pulls are about 50K.
That suggests there is a wire attached to that GPIO which is ...
The following is simplified code which prints a single reading.
Unless DHT.py is in the same directory it should be in a directory on the PYTHONPATH
A Program to read the DHTXX temperature/humidity sensors.
DHT.py download "module" from http://abyz.me.uk/rpi/pigpio/...
This is NOT Pi specific, and you have NOT provided sufficient detail to actually provide a definitive solution. The following is most likely the cause.
Unless pydub.py is in the same directory as your program it should be in a directory on the PYTHONPATH, BUT it is preferable to install with sudo pip3 install pydub so it is available to all users/programs.
The first is not fully incorrect but it's not correct either!
Yes the Pi is ARM but a lot of repositories for programs are compiled C or C++ and built ready by the distribution maintainers. Other code (e.g.PHP) does not care what the chipset is and then more source is compiled by users on their own machine. Instructions for building from source is here
Following instructions on this post I got it working.
Just make sure you boot to CLI.
sudo nano /home/pi/.bashrc
and add this to the end of the script:
echo Running at boot
sudo python3 /home/pi/filename.py