I'm having a Raspberry Pi 4 Model B. How to change date format in raspberry pi from dd/mm/yyyy to dd-mm-yyyy.
Current Raspberry Pi 4 Date Format
by following this guide I'm sure you can set the date format as "dd-mm-yyyy" on your LXDE desktop eg:
$ date +%d-%m-%Y
08-01-2021
Related
this is my first time working with a raspberry pi and also with structure code( full ladder coding here) My main objective is to connect 4 inputs on my raspberry pi GPIO, I need to count each pulse and display each one of them with a log (date and time) on a web page or any other suggestions to view the data.
I'm still new at coding and was able to put together some code from other sources for a simple weather station I built. Everything seems to be working fine but I do get the occasional hiccup where temperature readings on the display show additional decimals points beyond 0.1-0.9. I inserted a round command to round to the nearest decimal which I thought would take care of that but it still happens randomly. There are no issues when displaying temperature readings through the shell. It seems to add additional decimal points at random temperature readings just on the display. I've included pictures and code. Definitely would appreciate any help I can get figuring out this issue. Thank you.
from machine import Pin
import utime as time
from pico_i2c_lcd import I2cLcd
from machine import I2C
from DHT22 import DHT22
i2c = I2C(id=1,scl=Pin(27),sda=Pin(26),freq=100000)
lcd = I2cLcd(i2c, 0x27, 2, 16)
dht_data = Pin(15,Pin.IN,Pin.PULL_UP)
dht_sensor=DHT22(dht_data,Pin(14,Pin.OUT),dht11=False)
while True:
T,H = dht_sensor.read()
#Converted to Fahrenheit (FT) for LCD display
FT = T*1.8+32
if T is None:
print(" sensor error")
else:
print("{:3.1f}'C {:3.1f}%".format(T,H))
#DHT22 not responsive if delay too short
time.sleep_ms(500)
lcd.clear()
lcd.move_to(0,0)
lcd.putstr('Temp:')
lcd.move_to(10,0)
#If using Celsius, change (FT) to (T) and "F" to "C" on line below
lcd.putstr(str(round(FT, 1))+"F")
lcd.move_to(0,1)
lcd.putstr('Humidity:')
lcd.move_to(10,1)
lcd.putstr(str(H)+"%")`
what it normally looks like
the hiccup that randomly appears
Does anyone know of a good alternative to the DHT22 for temperature and humidity sensing on the Raspberry Pi?
The DHT22 works great, but the wire length can only be a few feet long before you start running into problems. I want to connect a temp/humidity sensor at about 15 feet away.
You can use some of 1-wire sensors, for example temperature>DS18B20 humidity>DS2438 or some else.
You can read more about 1-wire specification here
i have a raspberry pi connected with two ds18b20 temperature sensor.
-sensor1 is fixed on the outside of my garage (distance 20m from raspberry pi)
-sensor2 is just connected in a breadboard near the raspberry pi.
Everything is working well.
I decided to add sensor3 located outside and from 20m from the raspberry pi.
Now when i type :
cd /sys/bus/w1/devices
if find this:
c0-40a000061005 c2-246056869800 c2-247056869000 d0-008000001000 w1_bus_master1
instead of :
28-.....
28-.....
28-.....
each sensor ref should be start with 28-.....
what is happening with my sensors?
If unplugged the sensor1, then everything is well
if i unplug the sensor3 and let only sensor1 and sensor2 everything is well.
Which modification do we have to do when sensor are located far from the raspberry pi?
thank you
That means that the 3rd sensor doesn't have a 4.7kOhm or 10kOhm resistor between VCC and the OUT wire (black/red one if you have 4wire DS18B20).
Just connect that resistor and it will work , I had the same problem . I spent weeks to find such an easy solution. And if you get the same code after you connected the resistor , that means you didn't connected it properly.Hope will help you
I have rain gauge that has a PCB that counts the number of tips. From that PCB there is a output wire. I want to connect my Pi to that wire and count the number of tips and store the values for every half an hour or so. The whole setup should run on a battery.
I am planning to use weewx python library to do counting and storing data. But I want to know which terminal I should be connecting the rain gauge wire.