0

PiOLED for Mini AdBlocker noob question
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

PiOLED for Mini AdBlocker noob question

by aphexx0407 on Wed Sep 11, 2019 11:57 am

I just recently bought the Mini Ad Blocking Pi-Hole Kit with Pi Zero WH - No Soldering kit Adafruit PiOLED and had it setup and running. I was able to get Pi-Hole installed and information such as the IP, Ads Blocked, Client, and DNS Queries appears on the PiOLED using the code stated on this page https://learn.adafruit.com/pi-hole-ad-blocker-with-pi-zero-w?view=all#install-pioled.

I have noticed that when I unplugged the USB power cable from the Pi Zero WH and re-plugged it back ON the PiOLED will not show the display unless I ssh again to the device to run sudo python3 ~pi/stats.py

My question now is if there is a way to set my Pi Zero WH to automatically turn the PiOLED back ON after coming from a complete OFF stage (USB power cable unplugged) without the need for me to ssh to the device to run sudo python3 ~pi/stats.py ?

Another thing is I also noticed the information showing on the PiOLED doesn't change or update in real time, the numbers showing doesn't seem to refresh. I don't know if it's just me being fuzzy or I did something wrong. The only way for me to refresh the numbers is to ssh again to the device and run sudo python3 ~pi/stats.py

I am totally new to raspberry, this is my first raspberry device so pardon my ignorance. :)

aphexx0407
 
Posts: 30
Joined: Tue Sep 10, 2019 1:41 am

Re: PiOLED for Mini AdBlocker noob question

by adafruit_support_carter on Wed Sep 11, 2019 6:38 pm

Yep. That's covered here:
https://learn.adafruit.com/pi-hole-ad-b ... artup-6-37

The not-updating sounds odd though. Does it *never* update? Or just that it takes a while?

adafruit_support_carter
 
Posts: 12971
Joined: Tue Nov 29, 2016 2:45 pm

Re: PiOLED for Mini AdBlocker noob question

by aphexx0407 on Wed Sep 11, 2019 7:24 pm


That's the page I followed to edit the /etc/rc.local
The display did stayed ON after just a reboot but it never goes back ON automatically if I physically unplug the USB power cable and plug it back on. If I wanted to get the display back I will need to ssh to my pi device and run sudo python3 ~pi/stats.py

I have no issue with the display if it is just a simple reboot, the display on the PiOLED stays. Different story if my pi device is coming from a complete OFF state, like the USB power cable is unplugged to begin with.


The not-updating sounds odd though. Does it *never* update? Or just that it takes a while?

I am not sure if the stats showing on the PiOLED did updated at all or if it just takes a while?
Right before I went to bed the other night I checked the stats and when I woke up the following day the numbers are still the same. I don't know how long intervals times are for the stats to update itself, or if it suppose to update itself real time.

aphexx0407
 
Posts: 30
Joined: Tue Sep 10, 2019 1:41 am

Re: PiOLED for Mini AdBlocker noob question

by aphexx0407 on Wed Sep 11, 2019 7:57 pm

I had run another ssh session to my Pi again just to get the display back On. I took a photo of the stats, later this afternoon I will take another photo to compare the stats to see if it do update.
Attachments
20190912_093728-min.jpg
20190912_093728-min.jpg (497.64 KiB) Viewed 121 times

aphexx0407
 
Posts: 30
Joined: Tue Sep 10, 2019 1:41 am

Re: PiOLED for Mini AdBlocker noob question

by adafruit_support_carter on Wed Sep 11, 2019 8:02 pm

The display is updated approximately 10 times a second, via the simple sleep delay at the end of the loop:
Code: Select all | TOGGLE FULL SIZE
    time.sleep(.1)

But maybe the actual data has changed? Keep observing it and see what happens.

Not sure why the display doesn't work with a power cycle. That should be the same as a reboot.

You say it stays on with a reboot. That could be because power isn't removed and it's simply retaining the last display update. Does it look like it actually updates also after a reboot? Maybe rc.local isn't actually working?

adafruit_support_carter
 
Posts: 12971
Joined: Tue Nov 29, 2016 2:45 pm

Re: PiOLED for Mini AdBlocker noob question

by aphexx0407 on Wed Sep 11, 2019 8:36 pm

Confirmed, the stats (numbers) are still the same since I took a photo, which is like roughly 30mins ago. I rebooted my Pi using sudo reboot but the numbers did not changed.

I ran another ssh using PuTTY as it terminated my session during a reboot and ran another sudo python3 ~pi/stats.py, that's when the numbers updated. I have no clue why it only updates when I run the command.

Another thing is every time I run the sudo python3 ~pi/stats.py command my ssh session window using PuTTY gets stuck, I cannot get another command line after. If I wanted to run another command I have to close my session window and run PuTTY again to start a new session.

And, also I noticed is after I run sudo python3 ~pi/stats.py the stats (numbers) updates like every second if I keep the session window open. Once I close it then the stats will not update anymore. It seems like it only does it's thing when I have my PC on ssh session to the Pi.

What is wrong? Is it caused by some faulty file? I followed all the command line and modifications as stated in the tutorial.

aphexx0407
 
Posts: 30
Joined: Tue Sep 10, 2019 1:41 am

Re: PiOLED for Mini AdBlocker noob question

by aphexx0407 on Wed Sep 11, 2019 8:57 pm

PuTTY session.jpg
PuTTY session.jpg (132.73 KiB) Viewed 111 times

Here is the screenshot of my ssh session using PuTTY. If I keep that session window open even if it is stuck like that then stats (numbers on the PiOLED) will keep on updating.

aphexx0407
 
Posts: 30
Joined: Tue Sep 10, 2019 1:41 am

Re: PiOLED for Mini AdBlocker noob question

by adafruit_support_carter on Wed Sep 11, 2019 9:40 pm

It sounds like it's working. When you close the putty session, you also close the program, so it's no longer running.

Let's check you rc.local file. Run this and post a screen shot of the output:
Code: Select all | TOGGLE FULL SIZE
cat /etc/rc.local

adafruit_support_carter
 
Posts: 12971
Joined: Tue Nov 29, 2016 2:45 pm

Re: PiOLED for Mini AdBlocker noob question

by aphexx0407 on Wed Sep 11, 2019 11:12 pm

I did a complete reinstall from scratch again. I reformatted the microusb and started with the whole operation. I will let you know if there are some changes after this.

aphexx0407
 
Posts: 30
Joined: Tue Sep 10, 2019 1:41 am

Re: PiOLED for Mini AdBlocker noob question

by aphexx0407 on Wed Sep 11, 2019 11:46 pm

Update:

I completed a full reinstall and for some reason everything works now. I rebooted the Pi and the PiOLED now shows the stats, and it updates!

Next I tried to unplug the USB power cable and plugged it back in, it still works!

I don't know what happened before but now it is fully working as intended.

Thank you for the help.

aphexx0407
 
Posts: 30
Joined: Tue Sep 10, 2019 1:41 am

Re: PiOLED for Mini AdBlocker noob question

by aphexx0407 on Thu Sep 12, 2019 12:11 am

**Update 2

As I have mentioned the PiOLED now turns ON automatically from completely OFF state (USB cable unplugged), but one thing I noticed is that the stats doesn't update.

I went ahead and did another ssh and entered the command sudo reboot to reboot Pi. After the reboot that is when stats updated, from Ads Blocked: 394 to 756 after the reboot.

I don't know why it does that and why the stats did not update prior to reboot.

I will also be attaching a screenshot of the /etc/rc.local

Any idea why the stats did not auto update when Pi started from complete OFF state?

rc_local.jpg
rc_local.jpg (101.68 KiB) Viewed 86 times

aphexx0407
 
Posts: 30
Joined: Tue Sep 10, 2019 1:41 am

Re: PiOLED for Mini AdBlocker noob question

by adafruit_support_carter on Thu Sep 12, 2019 10:57 am

I went ahead and did another ssh and entered the command sudo reboot to reboot Pi. After the reboot that is when stats updated, from Ads Blocked: 394 to 756 after the reboot.

At this point, does it continue to update? Or did it only update the one time right after the reboot?

adafruit_support_carter
 
Posts: 12971
Joined: Tue Nov 29, 2016 2:45 pm

Re: PiOLED for Mini AdBlocker noob question

by aphexx0407 on Thu Sep 12, 2019 6:48 pm

adafruit_support_carter wrote:
I went ahead and did another ssh and entered the command sudo reboot to reboot Pi. After the reboot that is when stats updated, from Ads Blocked: 394 to 756 after the reboot.

At this point, does it continue to update? Or did it only update the one time right after the reboot?

Well the stats updated only after a reboot. But not after when the Pi started from a completely OFF state. Since after the reboot I did not touched the Pi anymore and it seemsnto be doing it's thing properly.

aphexx0407
 
Posts: 30
Joined: Tue Sep 10, 2019 1:41 am

Re: PiOLED for Mini AdBlocker noob question

by adafruit_support_carter on Fri Sep 13, 2019 12:11 pm

OK, sounds like it's working then. The stats.py program needs to be running for the display to update. When you SSH in and run it, it's only running as long as the SSH login is active. Modifying rc.local is what runs it at boot, and sounds like you've got that working now also.

adafruit_support_carter
 
Posts: 12971
Joined: Tue Nov 29, 2016 2:45 pm

Re: PiOLED for Mini AdBlocker noob question

by aphexx0407 on Fri Sep 13, 2019 12:52 pm

Weird because I did the same script modification to the rc.local during my first setup. I just had to scratch everything and start all over again to get it to work. Now the stats updates in real time even without the ssh connection, confirmed it while looking at the Pi dashboard on my phone and on the PiOLED.

Btw, since we are talking about the PiOLED I have another question. I've read on the description of the PiOLED that prolong usage will dim the screen. I am wondering if there is a way to maybe lower the brightness, or maybe set a time interval for the screen to activate?

I am not good with scripting so I have no idea if it is possible. I have tried searching online but couldn't find the one I am after.

Thank you in advance for the help.

aphexx0407
 
Posts: 30
Joined: Tue Sep 10, 2019 1:41 am

Please be positive and constructive with your questions and comments.