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 sudoresize2fs /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.
Well, the first part of my thermostat project is coming together. I’ve validated that I can power the Raspberry pi from a 24V AC source with what I’d consider minimal additional components. I’m still waiting for Adafruit to get the capacitive touch screen in stock but I believe this setup will be capable of powering the entire system. I created a forum thread for a brief “how to” on this topic. You can find it here. The next thing I will be testing are some relays that just arrived from Jameco which I’ll use to signal the HVAC unit to come on or shut off.
Well, I spent what time I had last night and tonight troubleshooting one of my Raspberry Pis. I couldn’t connect in via my VNC client so did a hard boot on it. I ended up with just a solid red PWR light. After investigating I determined the SD card is bad or corrupted. I ordered a new SD card from Amazon last night, received it today, and loaded a fresh Raspbian image. The Pi then booted and I was able to get x11vnc going again. I’ll have to do some further investigation on my other SD card to determine if the OS was just corrupted or if the SD card is truly bad. In any case, I lost several of the python programs I had created on there. Lesson learned, BACKUP!
On a side note, I did determine a method to trigger a Raspberry Pi to download updated data from a Mysql database. I followed the guide found here to send messages over the network using python. My plan is to utilize a PHP form to run a separate python script which will send a message to the remote Raspberry Pi which will essentially trigger it to go query the mysql database to download any changes the user makes in the Home Intelligence Management System I’m working on. This will eliminate me from having to constantly query the database looking at a flag indicating the data has changed. Next step, put together a functioning python program to control my water heater then be able to control it via a WordPress Plugin.
I purchased a couple of SCT 013-030 CTs for testing with my Raspberry Pi. The Raspberry Pi does not support analog values out of the box so I also purchased the Adafruit ADS1015 analog to digital converter. I got the ADS1015 working with the Pi following several examples found on the web. I then proceeded to look into getting the SCT 013-030 to work. This is turning out to be more “fun” than I expected. The SCT 013-030 includes a built in burden resistor of 38 ohms from what I’ve measured. With that in mind, hooking up a multimeter to the CT output should give us an AC voltage. I tested this and it appears working. The next step would be to measure the voltage using the Raspberry Pi and the ADS1015. Being that the voltage is AC I tried to figure out an “easy” way to grab the maximum voltage value. I put together a basic python program to sample at 128 samples per second and print the results with a time stamp. I discovered negative voltage values resulted in values over 12k but you could actually see the sine wave with the values. I tweaked the python code to ignore values over 12k then save the maximum voltage it sees for the 128 sps and figured this value should be fairly close to the right value. This value is in millivolts and needs converted to amps. To do this I took 1000mV=30A and divided both sides by 1,000. This results in 1mV = .03amps. So I took the millivolt reading from the Raspberry Pi and multiplied by .03 to get Amps.
This appears to somewhat work as I’ve tried three different loads, xbox 360, curling iron, and a halogen bulb. Unfortunately, the results seem low and high for the different loads when compared to my multimeter measurement. However, They do seem to be within maybe +- 10%. I’ll continue to troubleshoot but if anyone has any ideas I would greatly appreciate it.