Skip to content

notes from prototyping with a raspberry pi

joshua-8 edited this page Feb 16, 2021 · 6 revisions

goals:

  • receive data from mqtt
  • save data into a database
  • create and publicly serve .json file of data

Raspberry Pi OS Lite on pi 4B (no monitor or keyboard required)

add ssh file to boot

add wpa_supplicant.conf to boot

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
 ssid="chicken"
 psk="bawkbawk"
}

in cmd, ssh pi@10.0.0.129 password is raspberry

change password to something new with passwd command

sudo apt-get update sudo apt-get upgrade

sudo dpkg-reconfigure tzdata

sudo apt install mosquitto mosquitto-clients

make mosquitto auto start: sudo systemctl enable mosquitto.service

mosquitto_sub -d -t outTopic

mosquitto_pub -h localhost -t "inTopic" -m "hi"

sudo apt install sqlite3

sqlite> create table data (time text, vala integer,valb real);

insert into data (time,vala,valb) values (datetime('now'),14,1.2345);

select * from data;

.exit

sudo apt instal python3-pip

pip3 install paho-mqtt

scp pi@10.0.0.129:program.py Desktop