0

1.2" 7-segment Output Troubles
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: 1.2" 7-segment Output Troubles

by Waynetho on Sun Jul 31, 2016 1:23 pm

As I said before, I only used the GMT from dpkg-reconfigure to test the PM indicator. Using the region based timezones work but apparently dpkg-reconfigure was coded with inverted "MINUS" and "PLUS" settings (minus where plus should be and vice versa).

I took a somewhat risky approach to powering my wifi dongle and Pi Zero, but of course it's only a $5.00 risk, so what the hey! Instead of doing the usb power hack to power the dongle from the power connector, I used a OTG "Y" cable which has a microUSB power connection as well as microUSB data plug. The risky part is that I'm "back-powering" the Pi ZERO through the data port which means the power is not entering the board through the poly-fuse. This allows the wifi dongle to pull as much power as it needs, without going through the limitations of the ZERO's usb port and pull-down built into the OTG.

Waynetho
 
Posts: 17
Joined: Sat Jul 30, 2016 3:17 am

Re: 1.2" 7-segment Output Troubles

by mBPi on Sun Jul 31, 2016 5:33 pm

Waynetho wrote:As I said before, I only used the GMT from dpkg-reconfigure to test the PM indicator. Using the region based timezones work but apparently dpkg-reconfigure was coded with inverted "MINUS" and "PLUS" settings (minus where plus should be and vice versa).

I took a somewhat risky approach to powering my wifi dongle and Pi Zero, but of course it's only a $5.00 risk, so what the hey! Instead of doing the usb power hack to power the dongle from the power connector, I used a OTG "Y" cable which has a microUSB power connection as well as microUSB data plug. The risky part is that I'm "back-powering" the Pi ZERO through the data port which means the power is not entering the board through the poly-fuse. This allows the wifi dongle to pull as much power as it needs, without going through the limitations of the ZERO's usb port and pull-down built into the OTG.


Sorry, guess I don't understand what "dpkg-reconfigure" has to do with AM/PM or TIME at all...

Seems like an unnecessary risk; I have a PiZero connected to 4 8x8 Dot Matrices, and a Wifi Dongle connected to the USB, with power running through the PWR connector. Havent had any issues with not enough power... but to each their own right..

mBPi
 
Posts: 28
Joined: Sat Sep 05, 2015 11:09 pm

Re: 1.2" 7-segment Output Troubles

by Waynetho on Sun Jul 31, 2016 7:54 pm

The command "sudo dpkg-reconfigure tzdata" pulls up the ANSI (non-graphical) menu for configuring the timezone. I was using it to change to different timezones so the current time displayed on the clock was different and I could test the way it handled the AM and PM without waiting for the opposite time of day to arrive.

My wifi dongle works part of the time if plugged into USB with power going to the power plug, although due to the USB port current limit imposed on the Zero (I believe), it failed to initialize and light up at least once when I powered on the board. It may be possible to programmatically change the current limit on the USB port but then there's a risk of overtaxing the poly-fuze and burning it out. I may try the config before I finalize my wiring, to see if I can get a reliable init on the dongle.

Waynetho
 
Posts: 17
Joined: Sat Jul 30, 2016 3:17 am

Re: 1.2" 7-segment Output Troubles

by mBPi on Sun Jul 31, 2016 8:27 pm

Waynetho wrote:The command "sudo dpkg-reconfigure tzdata" pulls up the ANSI (non-graphical) menu for configuring the timezone. I was using it to change to different timezones so the current time displayed on the clock was different and I could test the way it handled the AM and PM without waiting for the opposite time of day to arrive.

My wifi dongle works part of the time if plugged into USB with power going to the power plug, although due to the USB port current limit imposed on the Zero (I believe), it failed to initialize and light up at least once when I powered on the board. It may be possible to programmatically change the current limit on the USB port but then there's a risk of overtaxing the poly-fuze and burning it out. I may try the config before I finalize my wiring, to see if I can get a reliable init on the dongle.


changing the timezone via raspi-config updates the time on the clock code immediately when select, so but if "sudo dpkg-reconfigure tzdata" works for you, by all means go for it...

I use these Dongles on all my Pis https://www.amazon.com/Edimax-EW-7811Un ... B003MTTJOY
with no issues. I've got one PiZero configured like detailed here http://n-o-d-e.net/post/138478383831/ho ... -raspberry
Mines a little different, as I just soldered a panel mounted (Female) USB connector, so that I could route the wire outside the case the PiZero is inside of. That way only "risk" is damage to the Wifi Dongle, and not the Pi itself. (as PiZeros are sometimes hard to come by, and often resold for high prices) - That PiZero controls the LED lighting of my PC case, and I didn't want the Wifi Dongle inside the metal PC case.

mBPi
 
Posts: 28
Joined: Sat Sep 05, 2015 11:09 pm

Re: 1.2" 7-segment Output Troubles

by Waynetho on Mon Aug 01, 2016 12:34 am

I used dpkg-reconfigure because most of my troubleshooting and modifications to the clock file were done remotely from my PC, without even so much as a video connection to use the Raspbian GUI. Some of the initial work was done on my Pi2 on which I used my HDMI cable attached to the second on my PC monitor. Unfortunately the HDMI to MINI/MICRO adapter I ordered from Amazon with the display and wifi dongle didn't show up with the first delivery so I couldn't view the ZERO directly.

I got the clock in the box now - I used some jury-rigging to mount the display to the inside of the cover of a project box (using card-edge and pin sockets from an old floppy cable, stacked up using 3M automotive double-sided tape.) The PI is nestled beneath, against the inside of the cover. In the bottom of the box, I cut a large rectangular hole. I used a sheet of red automotive tail-light lens plastic (about 1/32" thickness) which has adhesive on one side. I cut to it fit inside, stuck it in and covered the exposed adhesive exposed on the outside of the box with 2" clear box tape. A hole was cut in the cover to permit access to the female power socket.

Waynetho
 
Posts: 17
Joined: Sat Jul 30, 2016 3:17 am

Re: 1.2" 7-segment Output Troubles

by mBPi on Mon Aug 01, 2016 1:02 am

Waynetho wrote:I used dpkg-reconfigure because most of my troubleshooting and modifications to the clock file were done remotely from my PC, without even so much as a video connection to use the Raspbian GUI. Some of the initial work was done on my Pi2 on which I used my HDMI cable attached to the second on my PC monitor. Unfortunately the HDMI to MINI/MICRO adapter I ordered from Amazon with the display and wifi dongle didn't show up with the first delivery so I couldn't view the ZERO directly.

I got the clock in the box now - I used some jury-rigging to mount the display to the inside of the cover of a project box (using card-edge and pin sockets from an old floppy cable, stacked up using 3M automotive double-sided tape.) The PI is nestled beneath, against the inside of the cover. In the bottom of the box, I cut a large rectangular hole. I used a sheet of red automotive tail-light lens plastic (about 1/32" thickness) which has adhesive on one side. I cut to it fit inside, stuck it in and covered the exposed adhesive exposed on the outside of the box with 2" clear box tape. A hole was cut in the cover to permit access to the female power socket.


raspi-config works via terminal/ssh/serial... no video connection needed. I've never had a Pi connected to a monitor/screen. All mine are run headless.
I keep a .img of a configured raspbian build, and just write it to mSD when needed.

mBPi
 
Posts: 28
Joined: Sat Sep 05, 2015 11:09 pm

Re: 1.2" 7-segment Output Troubles

by Waynetho on Sun Aug 07, 2016 5:00 pm

mBPi wrote:raspi-config works via terminal/ssh/serial... no video connection needed. I've never had a Pi connected to a monitor/screen. All mine are run headless.
I keep a .img of a configured raspbian build, and just write it to mSD when needed.


I've been thinking about how Raspbian runs with the gui started, out of the box and was thinking it might have an impact on resources which might equate to power consumption.

On your clocks, do you run your Raspbian in command-line mode or do they still have the GUI active? I know there's probably a setting that can turn off gui but easier than that, there's an option from within the Raspbian setup shortcut to choose gui or command line by default. If in command line mode, I believe the command "sudo startx" will get start the gui.

Since I'm looking at various boost-converted battery supported options, I was just curious if there would be a power savings by turning off GUI (I know turning off HDMI will save directly in power usage).

Waynetho
 
Posts: 17
Joined: Sat Jul 30, 2016 3:17 am

Re: 1.2" 7-segment Output Troubles

by mBPi on Sun Aug 07, 2016 5:48 pm

Waynetho wrote:
mBPi wrote:raspi-config works via terminal/ssh/serial... no video connection needed. I've never had a Pi connected to a monitor/screen. All mine are run headless.
I keep a .img of a configured raspbian build, and just write it to mSD when needed.


I've been thinking about how Raspbian runs with the gui started, out of the box and was thinking it might have an impact on resources which might equate to power consumption.

On your clocks, do you run your Raspbian in command-line mode or do they still have the GUI active? I know there's probably a setting that can turn off gui but easier than that, there's an option from within the Raspbian setup shortcut to choose gui or command line by default. If in command line mode, I believe the command "sudo startx" will get start the gui.

Since I'm looking at various boost-converted battery supported options, I was just curious if there would be a power savings by turning off GUI (I know turning off HDMI will save directly in power usage).


All my Raspberry Pis run headless (no monitor) -- and I run Raspbian Lite -- remove packages I don't need like gnome.
I have no need for any desktop interface; everything I do can been done via SSH/SFTP.

running "sudo startx" would start up the desktop interface.

Disabling the HDMI port (which is done on my Pis) does reduce power consumption, I'm not sure if the Desktop Interface is really going to pull much less power then running without it...

mBPi
 
Posts: 28
Joined: Sat Sep 05, 2015 11:09 pm

Re: 1.2" 7-segment Output Troubles

by Waynetho on Sun Aug 21, 2016 3:30 am

I just succeeded in getting a CdS photocell (LDR) connected to my clock which dims the display to level "0" when the ambient light drops near zero. I started out by configuring the GPIO pin 18 as a pull-up input and tested it on each loop to set DIM whenever it's pulled low.. Then I bought an LM339 quad comparator from Radio Shack, as well as a small CdS sensor and a copper-pad perf board. The power source for the LM339 is the 3.3v rail and the reference voltage for the comparator uses two 10k resistors in a voltage divider arrangement, in series between 3.3v and GND. The middle connection is connected to the minus input on the comparator and reads about 1.645 vdc. On the positive input, a 56K resistor connects to 3.3v and the photocell connects to GND.

I socketed the resistor (56K) to make it easier to tweak the light threshold. Originally a 4K7 (4.7K) resistor sort-of worked but the display dimmed at a much higher light level than I wanted. A 15K resistor worked better but the 56K works even better still. When the light on my desk is turned away from the sensor, the display still stays bright but it will dim the display if I turn off the light,

Waynetho
 
Posts: 17
Joined: Sat Jul 30, 2016 3:17 am

Re: 1.2" 7-segment Output Troubles

by mBPi on Sun Aug 21, 2016 4:03 am

Waynetho wrote:I just succeeded in getting a CdS photocell (LDR) connected to my clock which dims the display to level "0" when the ambient light drops near zero. I started out by configuring the GPIO pin 18 as a pull-up input and tested it on each loop to set DIM whenever it's pulled low.. Then I bought an LM339 quad comparator from Radio Shack, as well as a small CdS sensor and a copper-pad perf board. The power source for the LM339 is the 3.3v rail and the reference voltage for the comparator uses two 10k resistors in a voltage divider arrangement, in series between 3.3v and GND. The middle connection is connected to the minus input on the comparator and reads abot 1.645 vdc. On the positive input, a 56K resistor connects to 3.3v and the photocell connects to GND.

I socketed the resistor (56K) to make it easier to tweak the light threshold. Originally a 4K7 (4.7K) resistor sort-of worked but the display dimmed at a much higher light level than I wanted. A 15K resistor worked better but the 56K works even better still. When the light on my desk is turned away from the sensor, the display still stays bright but it will dim the display if I turn off the light,


TSL2591 was much easier to use to achieve the same effect.
Also, a cheap+simple workaround is a Photocell + a couple additional resistors.

mBPi
 
Posts: 28
Joined: Sat Sep 05, 2015 11:09 pm

Re: 1.2" 7-segment Output Troubles

by Waynetho on Sun Aug 21, 2016 2:52 pm

mBPi wrote:TSL2591 was much easier to use to achieve the same effect.
Also, a cheap+simple workaround is a Photocell + a couple additional resistors.


From what I can tell, the TLS2591 is basically the same concept as an RC timing circuit only by way of communicating through I2C. As an experiment, I had already added working code to the clock to dim the display by pulling GPIO 18 low. I was looking for a solution that worked with the existing GPIO pin coding. I thought about the photocell+resistors idea, but figured it wasn't going to be reliable enough because it would rely on the UP/DOWN threshold levels of the GPIO input. The comparator provides a definite HI or LOW signal to the GPIO input pin.

Admittedly, this was the first time I'd ever worked with a comparator circuit so I was a little doubtful of its success.

Waynetho
 
Posts: 17
Joined: Sat Jul 30, 2016 3:17 am

Re: 1.2" 7-segment Output Troubles

by mBPi on Sun Aug 21, 2016 4:11 pm

Waynetho wrote:
mBPi wrote:TSL2591 was much easier to use to achieve the same effect.
Also, a cheap+simple workaround is a Photocell + a couple additional resistors.


From what I can tell, the TLS2591 is basically the same concept as an RC timing circuit only by way of communicating through I2C. As an experiment, I had already added working code to the clock to dim the display by pulling GPIO 18 low. I was looking for a solution that worked with the existing GPIO pin coding. I thought about the photocell+resistors idea, but figured it wasn't going to be reliable enough because it would rely on the UP/DOWN threshold levels of the GPIO input. The comparator provides a definite HI or LOW signal to the GPIO input pin.

Admittedly, this was the first time I'd ever worked with a comparator circuit so I was a little doubtful of its success.


There are many was for the reach the same results; as long as the results achieved are those wanted, that's what matters most.

Photocell+resistors works just fine as long as the correct sized resistor is used to result in a LOW/FALSE/DOWN state on the PIN.
Just depend on how you set/pull the PIN.

If you want to read the light level; a Photcell+Capacitor can be used instead. Using the GPIO (I think PIN 7) to determine how fast/slow the Capacitor is powered. This is not as accurate though.

I went with the TLS2591, be cause it's a small breakout that uses very little space, and is very accurate. Plus its able to detect different types of varying light sources which I needed. at just $6 on adafruit

mBPi
 
Posts: 28
Joined: Sat Sep 05, 2015 11:09 pm

Re: 1.2" 7-segment Output Troubles

by mBPi on Sun Aug 21, 2016 4:14 pm

mBPi wrote:
Waynetho wrote:
mBPi wrote:TSL2591 was much easier to use to achieve the same effect.
Also, a cheap+simple workaround is a Photocell + a couple additional resistors.


From what I can tell, the TLS2591 is basically the same concept as an RC timing circuit only by way of communicating through I2C. As an experiment, I had already added working code to the clock to dim the display by pulling GPIO 18 low. I was looking for a solution that worked with the existing GPIO pin coding. I thought about the photocell+resistors idea, but figured it wasn't going to be reliable enough because it would rely on the UP/DOWN threshold levels of the GPIO input. The comparator provides a definite HI or LOW signal to the GPIO input pin.

Admittedly, this was the first time I'd ever worked with a comparator circuit so I was a little doubtful of its success.


There are many was for the reach the same results; as long as the results achieved are those wanted, that's what matters most.

Photocell+resistors works just fine as long as the correct sized resistor is used to result in a LOW/FALSE/DOWN state on the PIN.
Just depend on how you set/pull the PIN.

If you want to read the light level; a Photcell+Capacitor can be used instead. Using the GPIO (I think PIN 7) to determine how fast/slow the Capacitor is powered. This is not as accurate though.

I went with the TLS2591, be cause it's a small breakout that uses very little space, and is very accurate. Plus its able to detect different types of varying light sources which I needed. at just $6 on adafruit

In one of my clock projects, I just use a PIR sensor to adjust brightness. No sense in using more power to the LEDs when no one is in the room ;)

mBPi
 
Posts: 28
Joined: Sat Sep 05, 2015 11:09 pm

Re: 1.2" 7-segment Output Troubles

by Waynetho on Wed May 31, 2017 1:07 pm

I recently had a wrinkle with one of my Pi clocks. My wife's clock does not use an RTC but I'm using the same SD image for both her clock and the one at my desk which DOES have an RTC. About several months ago we noticed that her clock would sometimes just go blank. Sometimes the Pi was still online and I could login and issue a remote reboot, but other times it was completely offline.

About a month ago I replaced the Pi Zero in both clocks with Pi ZeroW devices and then rebuilt the Raspbian and clock SD images. I thought that would solve the shutdown on my wife's clock but it still shuts down. Once I was able to login and restart the clock but today I wasn't sure which IP on my home network was the clock, so I pulled the power and reset it that way.

I suspect that adding an RTC to her clock might fix the issue since only the lack of RTC and the type of power supply in use are the common factors between the Pi Zero and Pi ZeroW versions.

Is there a way to change the code for the clock to allow the CTRL-C break but to IGNORE all errors and force the clock continue functioning (or even restart itself)? I feel like it has something to do with the "except:" line but don't have any idea how to make the change I'm looking for.

Waynetho
 
Posts: 17
Joined: Sat Jul 30, 2016 3:17 am

Re: 1.2" 7-segment Output Troubles

by Waynetho on Thu Jun 01, 2017 9:29 pm

I'm trying something today to see if it eliminates the shut-down issue encountered on my wife's clock. I know it's poor programming technique to do so but I've modified the except: traps by adding a "pass" after the error except. If I understand it correctly, this means it should break if it encounters a keyboard break but any other errors should be ignored.

Once again, I know that's not ideal and it's poor programming but if it keeps the clock going after it encounters an error it may be good enough.


EDIT: 6/11/17 - This didn't fix the script aborting. I replaced the power supply too because it was under-powered (.87 amps) but that didn't help either. My next step will be to make both clocks identical (add the RasClock 4.0 RTC that my clock already has. Only time will tell. Aside from the RTC, there are literally no other differences other than the LED display. Can a damaged LED display cause the Python script or even the Pi ZeroW to randomly shut down?

Code: Select all | TOGGLE FULL SIZE
except KeyboardInterrupt:
   print "\n####################################"
   print "A keyboard interruption was detected"
   print "####################################"

except:
   print "An error or exception has occurred!"
   pass  ### ignore all errors

finally:
   print "Cleaning Up"
   time.sleep(1)
   display.clear()
   display.write_display()

Waynetho
 
Posts: 17
Joined: Sat Jul 30, 2016 3:17 am

Please be positive and constructive with your questions and comments.