Well, after a ton of troubleshooting I finally figured out why my Raspberry Pi is hanging at a black screen with a cursor after I do a sudo apt-get upgrade.
I’ve been following the guide below on resizing my partition so that it was slightly smaller than the full 16GB of my SD card. I do this so I can make a complete image and back it up without worrying about the slight differences in sizes of SD cards.
Unfortunately, I kept missing the last step of running sudo resize2fs /dev/mmcblk0p2. If you skip this step and reboot prior to this step, the system comes up fine and you wouldn’t think there would be a problem. It was at that point I’d do a sudo apt-get update then a upgrade and reboot. Upon rebooting is when it would halt at the black screen with cursor. I doubt many others will have this problem but figured I’d post something in case it helps someone else.
Why would you want to resize your partition you ask and not simply use the expand file system feature from raspi-config? The reason I discovered, as many others apparently have, is that not all SD cards are created equal and their storage capacity changes over time. Why is this an issue? It becomes an issue if you want to make an image of your SD card and write it to other SD cards. Even if you have the “same” size SD card, lets say 16GB, the actual capacity of the card may vary. Over time, the capacity of the SD card will also decrease as sectors become unusable. So the purpose of re-sizing the partition is to leave some empty space so that the image is slightly smaller and will fit on other SD cards. For example, if my SD card is 16GB, I might size the partition to 15GB or less so that it will work on other 16GB cards.
In any case, if you’re interested in doing this with your running Raspberry Pi from the command line, I created this post in the forum on how to do it based on another site. I tested it and it does work.
The following is a guide to building a Raspberry Pi Sprinkler Timer.
- Get Raspbian Wheezy Installed and working.
- Run sudo apt-get update and upgrade.
- Setup whatever network connectivity you may plan on using, wired, wireless etc. This is not required but it’s nice for changing the settings.
- Build out the hardware: (I’ll provide more here later as this is a rough draft)
- Install your favorite remote desktop app, I use XNC. Make sure remote connectivity is working.
- sudo apt-get install python-imaging
- sudo apt-get install python-imaging-tk
- sudo apt-get install python-mysqldb
I just added a thread in the forum outlining how to setup the NRF24L01+ transceiver with the Raspberry Pi. More to threads to come on this topic as I progress.
In case anyone is interested, here is a comparison between the earlier 26 pin Raspberry Pis and the newer 40 pin versions.
It’s working! My Raspberry Pi Tkinter app now allows me to view and change the status of my water heater locally connected to the Raspberry Pi. It also updates the HIMS mysql database so that I can also view and change the settings on the HIMS. I’ll run through some additional testing then post code eventually.
Here’s a screenshot of the status page. It essentially shows if the unit is on or off and what the temperature is:
Here’s a screenshot of the settings page. It allows me to set up to 4 off sequences along with enabling data logging. Sequence 4 doesn’t work at this time but I set it up for 4 sequences.
I’ve made progress updating the python code for my electric water heater control project. With a few more hours of time, I should be ready to start testing the updated program out in more detail. Once it’s complete. I’ll post the code and some updated screenshots. I anticipate it to be much more reliable and efficient that my first take on the code assuming the SD card doesn’t get corrupted. At least with my tweaks even with a corrupted SD card I should still have hot water!
Well, after taking a break, I’ve started working more on my water heater setup and the HIMS. I’ve decided to make a local python tkinter GUI and some other changes. I’m currently getting things going but will post as I make progress. I figure the local GUI running on the Pi is a good fallback in the event the HIMS server dies as it did in the past.
Well, apparently my SD card in my raspberry pi LAMP server got corrupted. The backups I’ve been making of the entire card do not appear to be working correctly so I’ve been working on rebuilding it. Once I have things going again I’m going to focus on making a mirror image on another SD card to verify I can correctly make backups. Definitely frustrating. This has set me back a ways on my thermostat project as I get the server going again.
I received my Adafruit 2.8″ capacitive touch screen a little while ago and have been messing around with it. I followed the Adafruit guide found here and was able to get it working. I also find some instructions here to get the Pi to boot directly to the screen. The instructions essentially boil down to the following:
Install xserver-xorg-video-fbdev (My Raspbian image already had it installed)
sudo apt-get install xserver-xorg-video-fbdev
Create a config file with following contents in /usr/share/X11/xorg.conf.d/99-fbdev.conf containing the following:
Option "fbdev" "/dev/fb1"
After doing the above, my Pi boots to the piTFT screen. I then went about and set TightVNCserver to autostart.
My next steps include getting my basic Python TKinter app to load on boot and fill the screen. Once I have the screen functioning the way I want it for the Thermostat project, I’ll verify powering from the 24V AC line still works OK.
I verified the relays I purchased work as “expected”. I hadn’t realized I ordered latching relays but I did. No big deal, they’ll work but non latching would have been simpler as I will now need to utilize 2 GPIO ports per relay. I also did a little more research into wiring of my particular AC unit and believe I’m getting a better grasp on how it operates. More to come on this as I continue testing. On a side note, Adafruit got the touch screen in stock I wanted so I ordered that along with a but buttons and a case that may work for what I want with a few tweaks.