Courses Fragments Projects

Creating WHPFS

Yep, I temporarily name it WHPFD.

During this process, I met lots of trouble, physical, logical, and mental.

Besides, I learned a lot, including:
How to build a project on Raspberry Pi.
write code in Python.
use GPIO
use call back functions
run a script on boot up
Polished my skill using some new components.
Hall effect sensor
1602 Lcd screen
TIP 120
High torque servos

Technical troubles and solutions:
MG995 servo didn’t work
-The on-board power supply is not enough, I need external power supply
LED didn’t work
It’s a 5v Led… Needs external power supply too (what???)
Pi suddenly down.
-After 2 hours meaninglessly debugging, I find that the solution is to buy a new Pi, which works.(Sadly, this means I burned a $35 Pi)
Called a function to change the value of a variable in Python, didn’t work.
-If you want to change a value of a variable inside a function, you need to “globalize ” the variable inside the function.
How to build a timer in python? The way in P5js and Arduino doesn’t work.
-It’s simple, instead of using millis(), just use time()
Distance sensor VL53L0X is not a good way to get RPM.
-Distance sensor (can work 10 times per second, which means it can only work when the RPM is lower than 120. However, my spinner could reach an RPM of 300 in average.
Use hall effect sensor and magnet.
When I make the script start on boot up, some unexpected bugs occurred.
I guess (not confirmed) the reason is that this script runs before some of its dependency starts.
– Add a 10-second sleep before starting it.
– Don’t forget to add “&” at the end of the command if your script contains an infinite loop. If you do, you will have a hard time.
Solution: Access you file using a card reader, change the path of the script, which makes you command unavailable. Now you can access your Pi via TTL again.

Come on and see some pics:

Run it on boot

Learnt how to PComp with Pi and Python.
Useful library:

Added a LCD screen,×2-lcd-directly-with-a-raspberry-pi/python-code

LCD Display Tutorial for Raspberry Pi


Leave a Reply

Your email address will not be published. Required fields are marked *