bk1285 / rpi_wordclock

Software to create a Raspberry Pi based wordclock
GNU General Public License v3.0
214 stars 107 forks source link

Add Swedish as language in rpi wordclock #214

Open poa0314 opened 2 years ago

poa0314 commented 2 years ago

Everything here is new to me. I very much like to build a word clock in swedish. I have the electronics and the mechnical build in place but I struggle with the software that I am new to, but do my best to understand. From reading about others having different problems I have managed to ge the clock running in german. I thougt that the easiest way would be to overwrite german parts with the swedish equals. I have a layout for a frontplate in swedish, what else do I have to look in to? I would be very pleased if I could get any help.

FrankX0 commented 2 years ago

Do you still need help? I would suggest to create a new swedish.py entry in rpi_wordclock/wordclock_plugins/time_default/ With the help of other languages and the wiring layout and your own front design, you can then convert words to LED positions in swedish.py, And please use the develop branche. And once finished, make a pull request.

Please let me know if you need additional help.

poa0314 commented 2 years ago

Yes I still need help, and I am very pleased if you would help me. I have the hardware under control but need support with software. I have a layout for the frontplate and I think that I can look att german.py an make a swedish.py. Could you please explain "use develop branche and make pull request". As you can understand from my comments I have a lot to learn, this is a new world to me. I have read the basics of python to try and understand the scripts, and I have also made some basic scripts to control a ledstrip. I have spent a lot of time on this project and hope that I can finish it if I can get some support.

phenze commented 2 years ago

Take a look here to understand how to use the development branch : https://github.com/bk1285/rpi_wordclock/issues/211

For a quick overview how git works: https://rogerdudler.github.io/git-guide/index.de.html

To make a pull request you have to do the following steps:

Can you post a photo of your front layout? maybe i can help you.

phenze commented 2 years ago

And of course we need all possible translations

etc for every 5 minutes steps.

poa0314 commented 2 years ago

I have created a time_swedish.py -file. I have one question regarding this file. In german the time end with "UHR" this is not used in swedish, can i only remove these rows or do I hav to do someting elese also? I have also modified wordclock_config and added swedish in language_options.

time_swedish.txt wordclock_config.txt

I get this result when starting the clock, and it still run i german.

pi@raspberrypi:~ $ sudo python3 rpi_ws281x/python/rpi_wordclock/wordclock.py Parsing /home/pi/rpi_ws281x/python/rpi_wordclock/wordclock_config/wordclock_config.cfg Interface type set to gpio_low Wiring configuration WCA_WIDTH: 11 WCA_HEIGHT: 10 Num of LEDs: 114 Wiring layout: bernds_wiring WARNING: Default brightness value not set in config-file: To do so, add a "brightness" between 1..255 to the [wordclock_display]-section. Setting language to bavarian. Imported plugin 0: "feed_parser". Imported plugin 1: "time_as_words_dutch". INFO: No activate-flag set for plugin pycache within the config-file. Will be imported. No active exception to reraise Failed to import plugin pycache! Imported plugin 2: "test_strip". Imported plugin 3: "matrix". Imported plugin 4: "restart". Imported plugin 5: "leds_off". INFO: No activate-flag set for plugin time_in_seconds within the config-file. Will be imported. Imported plugin 6: "time_in_seconds". Imported plugin 7: "time_as_words_german". No module named 'pywapi' Failed to import plugin weather_forecast! Imported plugin 8: "tetris". Imported plugin 9: "shutdown". Imported plugin 10: "rainbow". Not found brigtness sensor value Using brigtness sensor : False Selected "time_default" as default plugin Imported plugin 11: "time_default". Imported plugin 12: "sunrise". INFO: No activate-flag set for plugin snake within the config-file. Will be imported. Imported plugin 13: "snake". Imported plugin 14: "ip_address". Imported plugin 15: "time_matrix". Running plugin time_default.

poa0314 commented 2 years ago

This is the front layout in swedish

Urtavla.pdf

phenze commented 2 years ago

Setting language to bavarian. Are you sure you are on the correct repo ? Look like you are on mine.

What is the output of ? git status

In your time_swedish you can modify what you want to. Removing the lines of code is fine.

To get the swedish language working you have to modify wordclock_tools/wordclock_display.py

Add an import for your language import wordclock_plugins.time_default.time_swedish as time_swedish

Add an else statement for swedish (Line 114)

elif language == 'swedish':
    self.taw = time_swedish.time_swedish()
poa0314 commented 2 years ago

I have nov modified wordclock_display.py as you described.

git status gives the following:

pi@raspberrypi:~/rpi_ws281x $ git status På grenen master Din gren är à jour med "origin/master".

Ospårade filer: (använd "git add ..." för att ta med i det som ska checkas in) python/rpi_wordclock/

inget köat för incheckning, men ospårade filer finns (spåra med "git add")

If I stand in folder rpi_wordclock

pi@raspberrypi:~/rpi_ws281x/python/rpi_wordclock $ git status På grenen master-python3 Din gren är à jour med "origin/master-python3".

Ändringar ej i incheckningskön: (använd "git add ..." för att uppdatera vad som ska checkas in) (använd "git restore ..." för att förkasta ändringar i arbetskatalogen) ändrad: wordclock_tools/wordclock_display.py

Ospårade filer: (använd "git add ..." för att ta med i det som ska checkas in) wordclock_config/wordclock_config_ori.cfg wordclock_plugins/time_default/time_swedish.py wordclock_tools/wordclock_display_ori.py

inga ändringar att checka in (använd "git add" och/eller "git commit -a")

Do you want me to change to english or can you understand what i means?

If I start the clock it still works in german

pi@raspberrypi:~ $ sudo python3 rpi_ws281x/python/rpi_wordclock/wordclock.py Parsing /home/pi/rpi_ws281x/python/rpi_wordclock/wordclock_config/wordclock_config.cfg Interface type set to gpio_low Wiring configuration WCA_WIDTH: 11 WCA_HEIGHT: 10 Num of LEDs: 114 Wiring layout: bernds_wiring WARNING: Default brightness value not set in config-file: To do so, add a "brightness" between 1..255 to the [wordclock_display]-section. Setting language to bavarian. Imported plugin 0: "feed_parser". Imported plugin 1: "time_as_words_dutch". INFO: No activate-flag set for plugin pycache within the config-file. Will be imported. No active exception to reraise Failed to import plugin pycache! Imported plugin 2: "test_strip". Imported plugin 3: "matrix". Imported plugin 4: "restart". Imported plugin 5: "leds_off". INFO: No activate-flag set for plugin time_in_seconds within the config-file. Will be imported. Imported plugin 6: "time_in_seconds". Imported plugin 7: "time_as_words_german". No module named 'pywapi' Failed to import plugin weather_forecast! Imported plugin 8: "tetris". Imported plugin 9: "shutdown". Imported plugin 10: "rainbow". Not found brigtness sensor value Using brigtness sensor : False Selected "time_default" as default plugin Imported plugin 11: "time_default". Imported plugin 12: "sunrise". INFO: No activate-flag set for plugin snake within the config-file. Will be imported. Imported plugin 13: "snake". Imported plugin 14: "ip_address". Imported plugin 15: "time_matrix". Running plugin time_default.

phenze commented 2 years ago

Okay there are several problems. I will try to explain it step by step.

1. You dont need to checkout and compile the rpi_ws281x library

Did you follow the python3 install instructions here ? https://github.com/bk1285/rpi_wordclock/tree/develop

2. The wordclock repo is in the wrong path (will be fixed in step 3)

3. You have checked out the wrong repo as i thought Steps to fix that

cd ~
git clone https://github.com/bk1285/rpi_wordclock.git
cd rpi_wordclock/
git checkout --track origin/develop

4. Before doing any changes

5. When noting helps

poa0314 commented 2 years ago

I am very greatful that you take the time to help me.

I think I start from scratch on a new SD-card and follow your instructions.

Is it possible to attach a .py-file here, I had to make it a txt-file to be able to attach it

time_swedish.txt

phenze commented 2 years ago

a text file is okay. You can post the code directly instead.

I have commited your time_swedish changes in my branch. Seems to work 👍

When you re install everything you can checkout my swedish branch directly instead of bernds develop branch (Step 5).

Later you can switch to bernds version again when the changes are merged.

poa0314 commented 2 years ago

I feel that the success is coming closer! I installed everything from scratch using https://github.com/bk1285/rpi_wordclock/tree/develop

After switching off audio it all worked fine i german.

Then I: cd ~ git clone https://github.com/phenze/rpi_wordclock rpi_wordclock_phenze cd rpi_wordclock_phenze/ git checkout --track origin/feature/swedish

And I got the following result pi@raspberrypi:~ $ cd ~ pi@raspberrypi:~ $ git clone https://github.com/phenze/rpi_wordclock rpi_wordclock_phenze Klonar till "rpi_wordclock_phenze"... remote: Enumerating objects: 5145, done. remote: Counting objects: 100% (2000/2000), done. remote: Compressing objects: 100% (1638/1638), done. remote: Total 5145 (delta 557), reused 1751 (delta 356), pack-reused 3145 Tar emot objekt: 100% (5145/5145), 15,99 MiB | 2,72 MiB/s, klart. Analyserar delta: 100% (2559/2559), klart. pi@raspberrypi:~ $ cd rpi_wordclock_phenze/ pi@raspberrypi:~/rpi_wordclock_phenze $ git checkout --track origin/feature/swedish Grenen feature/swedish ställdes in att spåra fjärrgrenen "feature/swedish" från "origin". Växlade till en ny gren "feature/swedish" pi@raspberrypi:~/rpi_wordclock_phenze $

I guess I did something wrong since I now have two folders. rpi_worldclock and worldclock_phenze

I understand that it must be frustrating trying to explain to a novice like me, how to perform the installation. My defence is that I am new to this and that I will be 70 in a few months and my brain perhaps works at a lower speed than earlier in life. Thanks again for helping me!

phenze commented 2 years ago

70 ?? And you doing that kind of stuff ? Thats amazing.

Stor respekt !

Everything is fine now. When the clock works in german that is exactly what we wanted.

You have two folder because you have used two different versions of the wordclock software.

In the folder rpi_worldclock there is @bk1285's Version which you should use in future. When all the swedish changes are merged back.

But for the moment you can use the software installed in the rpi_wordclock_phenze folder because there are all the needed changes for swedish (hopefully).

So all you have to do for now is:

Your cronjob entry should then look like that: @reboot sudo python3 /home/pi/rpi_wordclock_phenze/wordclock.py

poa0314 commented 2 years ago

Thank you for the encouraging comments! These days I do whatever I like from morning to evening and this is one of the things I like to spend my time on doing.

The clock is now working in Swedish!!!

I found some mistakes in time_swedish.py that i have corrected. I add the corrected file at the end.

I try to understand how the plugins can be activated?

Is it trigged by the pushbuttons and if so is this the only way to run them?

Another question is how to connect to wifi if I make a clock to a friend. Can it be done from a PC or even a phone?

time_swedish.txt

FrankX0 commented 2 years ago

The plugins can be activated by using the web interface. Just go to the IP address assigned to your clock.

phenze commented 2 years ago

Okay great. Is now everything working as expected for swedish? Then i will as @bk1285 to merge your changes to the main repo.

The Plugins can be activated in both ways (Buttons and via Web Interface).

1. Buttons

2. Web Interface

poa0314 commented 2 years ago

I have tried the Web interface and most of the plugins works great.

The only real problem I have now is that the clock suddenly can switch to german layout and then later back again. It can also be flickering between the Swedish and German layouts.

I do not know if this gives you an idea of the problem.

pi@raspberrypi:~ $ sudo python3 rpi_wordclock_phenze/wordclock.py 2021-12-16 09:59:42 raspberrypi root[1256] INFO Software version: v1.0.0-dev-113-ga9b49b6 2021-12-16 09:59:42 raspberrypi root[1256] INFO Parsing /home/pi/rpi_wordclock_phenze/wordclock_config/wordclock_config.cfg 2021-12-16 09:59:42 raspberrypi root[1256] INFO Interface type set to gpio_low 2021-12-16 09:59:42 raspberrypi root[1256] INFO Wiring configuration 2021-12-16 09:59:42 raspberrypi root[1256] INFO WCA_WIDTH: 11 2021-12-16 09:59:42 raspberrypi root[1256] INFO WCA_HEIGHT: 10 2021-12-16 09:59:42 raspberrypi root[1256] INFO Num of LEDs: 114 2021-12-16 09:59:42 raspberrypi root[1256] INFO Wiring layout: bernds_wiring 2021-12-16 09:59:42 raspberrypi root[1256] INFO Setting language to swedish. 2021-12-16 09:59:42 raspberrypi root[1256] INFO Imported plugin 0: "feed_parser". 2021-12-16 09:59:42 raspberrypi root[1256] INFO Skipping plugin time_as_words_dutch since it is set to activate=false in the config-file. 2021-12-16 09:59:42 raspberrypi root[1256] WARNING Defaulting to reference value for [plugin_test_strip] activate 2021-12-16 09:59:42 raspberrypi root[1256] INFO Imported plugin 1: "test_strip". 2021-12-16 09:59:42 raspberrypi root[1256] INFO Imported plugin 2: "matrix". 2021-12-16 09:59:42 raspberrypi root[1256] INFO Imported plugin 3: "restart". 2021-12-16 09:59:42 raspberrypi root[1256] INFO Imported plugin 4: "leds_off". 2021-12-16 09:59:42 raspberrypi root[1256] INFO Imported plugin 5: "time_in_seconds". 2021-12-16 09:59:42 raspberrypi root[1256] INFO Skipping plugin time_as_words_german since it is set to activate=false in the config-file. 2021-12-16 09:59:42 raspberrypi root[1256] WARNING Assumes no temperature sensor to be attached. 2021-12-16 09:59:42 raspberrypi root[1256] INFO Imported plugin 6: "weather_forecast". 2021-12-16 09:59:42 raspberrypi root[1256] INFO Imported plugin 7: "tetris". 2021-12-16 09:59:42 raspberrypi root[1256] INFO Imported plugin 8: "shutdown". 2021-12-16 09:59:42 raspberrypi root[1256] INFO Imported plugin 9: "rainbow". Using brigtness sensor : False 2021-12-16 09:59:42 raspberrypi root[1256] INFO Selected "time_default" as default plugin 2021-12-16 09:59:42 raspberrypi root[1256] INFO Imported plugin 10: "time_default". 2021-12-16 09:59:43 raspberrypi root[1256] INFO Imported plugin 11: "sunrise". 2021-12-16 09:59:43 raspberrypi root[1256] INFO Imported plugin 12: "snake". 2021-12-16 09:59:43 raspberrypi root[1256] INFO Imported plugin 13: "ip_address". 2021-12-16 09:59:43 raspberrypi root[1256] INFO Imported plugin 14: "time_matrix".

phenze commented 2 years ago

Yes. There a running another instance of the wordclock.

Remember that you have to versions installed. Did you add anything to the crontab yet (sudo crontab -e)?

Remember in your case you have to change the line: @reboot sudo python3 /home/pi/rpi_wordclock/wordclock.py to @reboot sudo python3 /home/pi/rpi_wordclock_phenze/wordclock.py

Change it and then after a restart everything should run fine.

When adding anything to the crontab you dont have to manually start the wordclock. This will get startet automatically

poa0314 commented 2 years ago

The plugins and the clock now works fine, but I found an error in time_swedish. In german number ZWÖLF is on the first and last row of list(range). I guess that it has to do with how the time is presented in german, and perhaps the use of "UHR" in the end. Do you have enough information to guide me how to do.

Is there a better way to check that all times are correct than look at the clock for twelve hours?

self.hours= [list(range(49,54)), \ list(range(57,60)), \ list(range(55,59)), \ list(range(67,71)), \ list(range(84,88)), \ list(range(73,77)), \ list(range(100,105)), \ list(range(60,66)), \ list(range(89,93)), \ list(range(80,84)), \ list(range(93,97)), \ list(range(77,80)), \ list(range(49,54))] self.full_hour= list(range(107,110)) a

phenze commented 2 years ago

You can use the simulator and set a time manually. But i think that will be a little bit to hard to explain.

You can send be a full list of possible time values an i will check it for you. In the meantime there is no better way than looking at it for twelve hours :D

All is need is what should be displayed in every 5 minute step. And a list of all possible hour values.

poa0314 commented 2 years ago

Hope that this is what you are looking for. I have typed it in next to the german equals.

I have seen that hour "TOLV" is missing the "T" and that pixel 60 is on at some times and should never be on.

Urtavla.pdf

This class returns a given time as words (string):: """

def __init__(self):
    self.prefix = "ES IST "     KLOCKAN ÄR
    self.minutes = ["",
        "FUNF NACH ", \         FEM ÖVER
        "ZEHN NACH ", \         TIO ÖVER
        "VIERTEL NACH ", \      KVART ÖVER
        "ZWANZIG NACH ", \      TJUGO ÖVER
        "FUNF VOR HALB ", \     FEM I HALV
        "HALB ", \              HALV
        "FUNF NACH HALB ", \    FEM ÖVER HALV
        "ZWANZIG VOR ", \       TJUGO I
        "VIERTEL VOR ", \       KVART I
        "ZEHN VOR ", \          TIO I
        "FUNF VOR "]            FEM I
    self.hours = ["ZWOLF", \    TOLV
        "EIN", \                ETT
        "ZWEI", \               TVÅ
        "DREI", \               TRE
        "VIER", \               FYRA
        "FUNF", \               FEM
        "SECHS", \              SEX
        "SIEBEN", \             SJU
        "ACHT", \               ÅTTA
        "NEUN", \               NIO
        "ZEHN", \               TIO
        "ELF", \                ELVA
        "ZWOLF"]                TOLV
    self.full_hour_suffix = " UHR" NOT USED
poa0314 commented 2 years ago

I found some cosmetic changes that place the "I" closer to the different minutes. I include the modified file. I guess that the original problems remains and appers round tvelve. I will look att that round midnight or lunchtime.

time_swedish.txt

poa0314 commented 2 years ago

I think that I have solved the problems with "time_swedish", but it is difficult to check everything without spending a whole day in front of the clock.

When I am now almost satisfied how the clock works I am looking for a safe way to copy/clone the SD-card. I have heard that som of these tools are dangerous to use. Do you know anything regarding EaseUS or any other tool?

Uppdaterad fil. time_swedish.py.txt

FrankX0 commented 2 years ago

Nice to know the clock also speaks Swedish now! Regarding backup and restore of your SD card: I would suggest Etcher.

poa0314 commented 2 years ago

Is it possible to clone an SD-card including OS with Etcher?

I tried using Copy using Raspberry Pi. It works but without OS as I understand it.

I use Raspberry Pi Imager to install OS and language and wifi. It has an option #custom.img", is this a way to create a clone?

FrankX0 commented 2 years ago

With Etcher you clone the entire SD card. As far as I know PI imager is to install an online image or a custom image you downloaded yourself.

poa0314 commented 2 years ago

Etcher was the perfect tool for me and worked without any problems.

I now have to finalize the mechanical build with a rusty steel frontplate.

The only thing I miss is a light sensor controlling the LEDs. Is this an ongoing job?

I am very greatful for all excellent support!

phenze commented 2 years ago

Sorry i don't had a minute this weekend.

I have checked your changes. Everything looks good now 👍 Well done. I will ask Bernd to merge it back in the development branch.

I have a working light sensor. Needed code is already implemented. All you have to do is to install a lux sensor (i have used tsl2561).

Then you can enable using the brightness sensor in the config file (use_brightness_sensor = true)

For more inspiration : https://github.com/bk1285/rpi_wordclock/issues/139 https://github.com/bk1285/rpi_wordclock/issues/27

poa0314 commented 2 years ago

Excellent, du you also have info how to wire it?

Den mån 20 dec. 2021 07:42Pascal Henze @.***> skrev:

Sorry i don't had a minute this weekend.

I have checked your changes. Everything looks good now 👍 Well done. I will ask Bernd to merge it back in the development branch.

I have a working light sensor. Needed code is already implemented. All you have to do is to install a lux sensor (i have used tsl2561).

Then you can enable using the brightness sensor in the config file (use_brightness_sensor = true)

For more inspiration :

139 https://github.com/bk1285/rpi_wordclock/issues/139

27 https://github.com/bk1285/rpi_wordclock/issues/27

— Reply to this email directly, view it on GitHub https://github.com/bk1285/rpi_wordclock/issues/214#issuecomment-997640810, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWUDHRKRKTRORV6BWTSABLLUR3F7HANCNFSM5JCW7KVA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

phenze commented 2 years ago

wire_tsl2561

poa0314 commented 2 years ago

I have finally got a 2561 board and have connected it. The type is: CJMCU-2561 Digital light sensor v0.9b. I have connected it as described above. Only difference is that tha supply voltage was marked 5V on th board so iI connected it to 5V. SDA to pin 3 and SCL to pin 5.

I changed in the config file to.

Set the brightness of the display (between 1 and 255)

brightness = 200 use_brightness_sensor = True

pi@raspberrypi:~/rpi_wordclock_phenze $ sudo python3 wordclock.py 2022-01-21 17:33:16 raspberrypi root[1214] INFO Software version: v1.0.0-dev-114-g052b87f 2022-01-21 17:33:16 raspberrypi root[1214] INFO Parsing /home/pi/rpi_wordclock_phenze/wordclock_config/wordclock_config.cfg 2022-01-21 17:33:16 raspberrypi root[1214] INFO Interface type set to gpio_low 2022-01-21 17:33:16 raspberrypi root[1214] INFO Wiring configuration 2022-01-21 17:33:16 raspberrypi root[1214] INFO WCA_WIDTH: 11 2022-01-21 17:33:16 raspberrypi root[1214] INFO WCA_HEIGHT: 10 2022-01-21 17:33:16 raspberrypi root[1214] INFO Num of LEDs: 114 2022-01-21 17:33:16 raspberrypi root[1214] INFO Wiring layout: bernds_wiring 2022-01-21 17:33:16 raspberrypi root[1214] INFO Setting language to swedish. 2022-01-21 17:33:16 raspberrypi root[1214] INFO Imported plugin 0: "feed_parser". 2022-01-21 17:33:16 raspberrypi root[1214] INFO Skipping plugin time_as_words_dutch since it is set to activate=false in the config-file. 2022-01-21 17:33:16 raspberrypi root[1214] WARNING Defaulting to reference value for [plugin_test_strip] activate 2022-01-21 17:33:16 raspberrypi root[1214] INFO Imported plugin 1: "test_strip". 2022-01-21 17:33:16 raspberrypi root[1214] INFO Imported plugin 2: "matrix". 2022-01-21 17:33:16 raspberrypi root[1214] INFO Imported plugin 3: "restart". 2022-01-21 17:33:16 raspberrypi root[1214] INFO Imported plugin 4: "leds_off". 2022-01-21 17:33:16 raspberrypi root[1214] INFO Imported plugin 5: "time_in_seconds". 2022-01-21 17:33:16 raspberrypi root[1214] INFO Skipping plugin time_as_words_german since it is set to activate=false in the config-file. 2022-01-21 17:33:16 raspberrypi root[1214] INFO Skipping plugin weather_forecast since it is set to activate=false in the config-file. 2022-01-21 17:33:16 raspberrypi root[1214] INFO Imported plugin 6: "tetris". 2022-01-21 17:33:16 raspberrypi root[1214] INFO Imported plugin 7: "shutdown". 2022-01-21 17:33:16 raspberrypi root[1214] INFO Imported plugin 8: "rainbow". Using brigtness sensor : True Importing sensor Library No Hardware I2C on (scl,sda)=(3, 2) Valid I2C ports: ((1, 3, 2), (0, 1, 0)) 2022-01-21 17:33:16 raspberrypi root[1214] WARNING Failed to import plugin time_default! Traceback (most recent call last): File "/home/pi/rpi_wordclock_phenze/wordclock.py", line 82, in init self.plugins.append(import_module('wordclock_plugins.' + plugin + '.plugin').plugin(self.config)) ValueError: No Hardware I2C on (scl,sda)=(3, 2) Valid I2C ports: ((1, 3, 2), (0, 1, 0)) 2022-01-21 17:33:16 raspberrypi root[1214] INFO Imported plugin 9: "sunrise". 2022-01-21 17:33:16 raspberrypi root[1214] INFO Imported plugin 10: "snake". 2022-01-21 17:33:16 raspberrypi root[1214] INFO Imported plugin 11: "ip_address". 2022-01-21 17:33:16 raspberrypi root[1214] INFO Imported plugin 12: "time_matrix".

What could be the problem?

FrankX0 commented 2 years ago

There is an error saying there is no hardware I2C. You should enable this with sudo sudo raspi-config

poa0314 commented 2 years ago

I get a little bit further but still no clock running. 'pi@raspberrypi:~/rpi_wordclock_phenze $ sudo python3 wordclock.py 2022-01-21 21:14:43 raspberrypi root[1209] INFO Software version: v1.0.0-dev-114-g052b87f 2022-01-21 21:14:43 raspberrypi root[1209] INFO Parsing /home/pi/rpi_wordclock_phenze/wordclock_config/wordclock_config.cfg 2022-01-21 21:14:43 raspberrypi root[1209] INFO Interface type set to gpio_low 2022-01-21 21:14:43 raspberrypi root[1209] INFO Wiring configuration 2022-01-21 21:14:43 raspberrypi root[1209] INFO WCA_WIDTH: 11 2022-01-21 21:14:43 raspberrypi root[1209] INFO WCA_HEIGHT: 10 2022-01-21 21:14:43 raspberrypi root[1209] INFO Num of LEDs: 114 2022-01-21 21:14:43 raspberrypi root[1209] INFO Wiring layout: bernds_wiring 2022-01-21 21:14:43 raspberrypi root[1209] INFO Setting language to swedish. 2022-01-21 21:14:43 raspberrypi root[1209] INFO Imported plugin 0: "feed_parser". 2022-01-21 21:14:43 raspberrypi root[1209] INFO Skipping plugin time_as_words_dutch since it is set to activate=false in the config-file. 2022-01-21 21:14:43 raspberrypi root[1209] WARNING Defaulting to reference value for [plugin_test_strip] activate 2022-01-21 21:14:43 raspberrypi root[1209] INFO Imported plugin 1: "test_strip". 2022-01-21 21:14:43 raspberrypi root[1209] INFO Imported plugin 2: "matrix". 2022-01-21 21:14:43 raspberrypi root[1209] INFO Imported plugin 3: "restart". 2022-01-21 21:14:43 raspberrypi root[1209] INFO Imported plugin 4: "leds_off". 2022-01-21 21:14:43 raspberrypi root[1209] INFO Imported plugin 5: "time_in_seconds". 2022-01-21 21:14:43 raspberrypi root[1209] INFO Skipping plugin time_as_words_german since it is set to activate=false in the config-file. 2022-01-21 21:14:43 raspberrypi root[1209] INFO Skipping plugin weather_forecast since it is set to activate=false in the config-file. 2022-01-21 21:14:43 raspberrypi root[1209] INFO Imported plugin 6: "tetris". 2022-01-21 21:14:43 raspberrypi root[1209] INFO Imported plugin 7: "shutdown". 2022-01-21 21:14:43 raspberrypi root[1209] INFO Imported plugin 8: "rainbow". Using brigtness sensor : True Importing sensor Library No I2C device at address: 0x39 2022-01-21 21:14:43 raspberrypi root[1209] WARNING Failed to import plugin time_default! Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/adafruit_bus_device/i2c_device.py", line 154, in __probe_for_device self.i2c.writeto(self.device_address, b"") OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/adafruit_bus_device/i2c_device.py", line 160, in __probe_for_device self.i2c.readfrom_into(self.device_address, result) OSError: [Errno 121] Remote I/O error

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/pi/rpi_wordclock_phenze/wordclock.py", line 82, in init self.plugins.append(import_module('wordclock_plugins.' + plugin + '.plugin').plugin(self.config)) ValueError: No I2C device at address: 0x39 2022-01-21 21:14:44 raspberrypi root[1209] INFO Imported plugin 9: "sunrise". 2022-01-21 21:14:44 raspberrypi root[1209] INFO Imported plugin 10: "snake". 2022-01-21 21:14:44 raspberrypi root[1209] INFO Imported plugin 11: "ip_address". 2022-01-21 21:14:44 raspberrypi root[1209] INFO Imported plugin 12: "time_matrix".

FrankX0 commented 2 years ago

It cannot find the sensor (at address 0x39). Maybe check your wiring?

poa0314 commented 2 years ago

Could it be so that I have bought wrong type of lightsensor that is not working with Raspberry Pi?

GY-2561 Helligkeits- Luminosity- IR Lux Sensor TSL2561 I2C ESP8266 ArduinoGY-2561 Helligkeits- Luminosity- IR Lux Sensor TSL2561 I2C ESP8266 Arduino Brandneu EUR 7,48  EUR 7,48 pro Einheit(EUR 7,48/Einheit) Bis 10% sparen mit Multi-Rabatt Sofort-Kaufen+EUR 5,90 Versandaus Deutschland

FrankX0 commented 2 years ago

Sensor should work. Maybe first try to debug without the clock running. Maybe this helps: https://www.instructables.com/Lux-Sensor-TSL2561-Raspberry-Pi/

Additionaly: does your board have an ADDR pin? Is it left unconnected?

poa0314 commented 2 years ago

My board do not have an ADDR pin. It has 4 pins 0V, 5V, SCL, GND. I have tried to understand the information in your link above but this seems to be above my competence to understand. during installation of the clock I have followed : https://github.com/phenze/rpi_wordclock/tree/master-python3 I the Readmefile it states: ⏳ In progress Integration of a brightness sensor

Do this mean that code is missing to ues teh TSL2561 sensor?

FrankX0 commented 2 years ago

The code you are using does support the sensor. The sensor itself is not detected in your case (No I2C device at address: 0x39). Maybe it is at a different address. Can you change following line: address = 0x39 ## Device address (at this location) to 0x29 and to 0x49? These are the other addresses supported by this sensor.

poa0314 commented 2 years ago

Is it in the file plugin.py that I should make the changes?

The file looks different from the file you have linked to and have no information about address.

Copy of the rows regarding brightness sensor in my plugin.py:

  self.brightness_mode_pos = config.getint('wordclock_display', 'brightness')
    self.brightness_change = 8

    self.use_brightness_sensor = config.getboolean('wordclock_display', 'use_brightness_sensor')

    print(('Using brigtness sensor : ' + str(self.use_brightness_sensor)))
    if self.use_brightness_sensor:
        print('Importing sensor Library ')
        import board
        import busio
        import adafruit_tsl2561
        i2c = busio.I2C(board.SCL, board.SDA)
        self.sensor = adafruit_tsl2561.TSL2561(i2c)
    # save current brightness for switching back from sleep mode
    self.wake_brightness = self.brightness_mode_pos
FrankX0 commented 2 years ago

You are apparently using a different branch than I was expecting. For this implementation I could not find (yet) how (or if) to set the I2C address.

So, can you try the following:

This will list all I2C devices found.

poa0314 commented 2 years ago

Thank you for trying to help me to solv the problem!

This was the result.

pi@raspberrypi:~ $ sudo apt-get install i2c-tools Läser paketlistor… Färdig Bygger beroendeträd… Färdig Läser tillståndsinformation… Färdig i2c-tools is already the newest version (4.2-1+b1). i2c-tools är satt till manuellt installerad. Följande paket har installerats automatiskt och är inte längre nödvändigt: libfuse2 Använd ”sudo apt autoremove” för att ta bort det. 0 att uppgradera, 0 att nyinstallera, 0 att ta bort och 119 att inte uppgradera. pi@raspberrypi:~ $ i2 detect -y 1 bash: i2: kommandot finns inte pi@raspberrypi:~ $ i2detect -y 1 bash: i2detect: kommandot finns inte pi@raspberrypi:~ $ i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- 29 -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --
pi@raspberrypi:~ $

FrankX0 commented 2 years ago

That is a step forward! So the sensor is at 0x29, not at 0x39. No we need to figure out how to set the address in the Python code.

FrankX0 commented 2 years ago

Can you try to change self.sensor = adafruit_tsl2561.TSL2561(i2c) to self.sensor = adafruit_tsl2561.TSL2561(i2c,0x29)

poa0314 commented 2 years ago

Thank you very much! The light sensor is now working. I am very impressed by the support I have got trying to build a Swedish Wordclock. I am now only missing the frontplate in rusty steel but I am more familiar with that job than the programming.

Thank you once again for excellent support!

poa0314 commented 2 years ago

I am sorry to disturb you again!

Everything worked fine so I did clone the SD card to have a backup. After the clone nothing worked as it should not even with the original SD card. I think I did it correctly using clone in balena Etcher. It looked as if I used the wrong SD as source since the last updates on where not done. I have now made the last updates again but nothing works, no LEDs are working. I tried to understad the logfile but no success.

I get Low voltage warnings could that be the problem. I supply the Pi and the LEDs with 5V 10A powersupply. I do the power supply to the Pi via pin 2 not using the mini usb port. I have had the same wiring all the time with no problems.

pi@raspberrypi:~ $ sudo python3 rpi_wordclock_phenze/wordclock.py 2022-02-02 10:26:57 raspberrypi root[1551] INFO Software version: v1.0.0-dev-114-g052b87f 2022-02-02 10:26:57 raspberrypi root[1551] INFO Parsing /home/pi/rpi_wordclock_phenze/wordclock_config/wordclock_config.cfg 2022-02-02 10:26:57 raspberrypi root[1551] INFO Interface type set to gpio_low 2022-02-02 10:26:57 raspberrypi root[1551] INFO Wiring configuration 2022-02-02 10:26:57 raspberrypi root[1551] INFO WCA_WIDTH: 11 2022-02-02 10:26:57 raspberrypi root[1551] INFO WCA_HEIGHT: 10 2022-02-02 10:26:57 raspberrypi root[1551] INFO Num of LEDs: 114 2022-02-02 10:26:57 raspberrypi root[1551] INFO Wiring layout: bernds_wiring 2022-02-02 10:26:57 raspberrypi root[1551] INFO Setting language to swedish. 2022-02-02 10:26:58 raspberrypi root[1551] INFO Imported plugin 0: "feed_parser". 2022-02-02 10:26:58 raspberrypi root[1551] INFO Skipping plugin time_as_words_dutch since it is set to activate=false in the config-file. 2022-02-02 10:26:58 raspberrypi root[1551] WARNING Defaulting to reference value for [plugin_test_strip] activate 2022-02-02 10:26:58 raspberrypi root[1551] INFO Imported plugin 1: "test_strip". 2022-02-02 10:26:58 raspberrypi root[1551] INFO Imported plugin 2: "matrix". 2022-02-02 10:26:58 raspberrypi root[1551] INFO Imported plugin 3: "restart". 2022-02-02 10:26:58 raspberrypi root[1551] INFO Imported plugin 4: "leds_off". 2022-02-02 10:26:58 raspberrypi root[1551] INFO Imported plugin 5: "time_in_seconds". 2022-02-02 10:26:58 raspberrypi root[1551] INFO Skipping plugin time_as_words_german since it is set to activate=false in the config-file. 2022-02-02 10:26:58 raspberrypi root[1551] INFO Skipping plugin weather_forecast since it is set to activate=false in the config-file. 2022-02-02 10:26:58 raspberrypi root[1551] INFO Imported plugin 6: "tetris". 2022-02-02 10:26:58 raspberrypi root[1551] INFO Imported plugin 7: "shutdown". 2022-02-02 10:26:58 raspberrypi root[1551] INFO Imported plugin 8: "rainbow". Using brigtness sensor : True Importing sensor Library 2022-02-02 10:26:58 raspberrypi root[1551] INFO Selected "time_default" as default plugin 2022-02-02 10:26:58 raspberrypi root[1551] INFO Imported plugin 9: "time_default". 2022-02-02 10:26:58 raspberrypi root[1551] INFO Imported plugin 10: "sunrise". 2022-02-02 10:26:58 raspberrypi root[1551] INFO Imported plugin 11: "snake". 2022-02-02 10:26:58 raspberrypi root[1551] INFO Imported plugin 12: "ip_address". 2022-02-02 10:26:58 raspberrypi root[1551] INFO Imported plugin 13: "time_matrix".

pi@raspberrypi:~ $

phenze commented 2 years ago

The error message is Address already in use. So the wordclock software cannot start the local Web server.

Seems that there is some other process running on port 80. Did you install anything else ?

Perhaps another instance of the software is running? You can check this with: ps aux | grep python

poa0314 commented 2 years ago

I removed Crontab and started it manually.

Then I did not get this error message but still no LEDs.

pi@raspberrypi:~ $ sudo python3 rpi_wordclock_phenze/wordclock.py 2022-02-02 17:18:14 raspberrypi root[2276] INFO Software version: v1.0.0-dev-114-g052b87f 2022-02-02 17:18:14 raspberrypi root[2276] INFO Parsing /home/pi/rpi_wordclock_phenze/wordclock_config/wordclock_config.cfg 2022-02-02 17:18:14 raspberrypi root[2276] INFO Interface type set to gpio_low 2022-02-02 17:18:14 raspberrypi root[2276] INFO Wiring configuration 2022-02-02 17:18:14 raspberrypi root[2276] INFO WCA_WIDTH: 11 2022-02-02 17:18:14 raspberrypi root[2276] INFO WCA_HEIGHT: 10 2022-02-02 17:18:14 raspberrypi root[2276] INFO Num of LEDs: 114 2022-02-02 17:18:14 raspberrypi root[2276] INFO Wiring layout: bernds_wiring 2022-02-02 17:18:14 raspberrypi root[2276] INFO Setting language to swedish. 2022-02-02 17:18:15 raspberrypi root[2276] INFO Imported plugin 0: "feed_parser". 2022-02-02 17:18:15 raspberrypi root[2276] INFO Skipping plugin time_as_words_dutch since it is set to activate=false in the config-file. 2022-02-02 17:18:15 raspberrypi root[2276] WARNING Defaulting to reference value for [plugin_test_strip] activate 2022-02-02 17:18:15 raspberrypi root[2276] INFO Imported plugin 1: "test_strip". 2022-02-02 17:18:15 raspberrypi root[2276] INFO Imported plugin 2: "matrix". 2022-02-02 17:18:15 raspberrypi root[2276] INFO Imported plugin 3: "restart". 2022-02-02 17:18:15 raspberrypi root[2276] INFO Imported plugin 4: "leds_off". 2022-02-02 17:18:15 raspberrypi root[2276] INFO Imported plugin 5: "time_in_seconds". 2022-02-02 17:18:15 raspberrypi root[2276] INFO Skipping plugin time_as_words_german since it is set to activate=false in the config-file. 2022-02-02 17:18:15 raspberrypi root[2276] INFO Skipping plugin weather_forecast since it is set to activate=false in the config-file. 2022-02-02 17:18:15 raspberrypi root[2276] INFO Imported plugin 6: "tetris". 2022-02-02 17:18:15 raspberrypi root[2276] INFO Imported plugin 7: "shutdown". 2022-02-02 17:18:15 raspberrypi root[2276] INFO Imported plugin 8: "rainbow". Using brigtness sensor : True Importing sensor Library 2022-02-02 17:18:15 raspberrypi root[2276] INFO Selected "time_default" as default plugin 2022-02-02 17:18:15 raspberrypi root[2276] INFO Imported plugin 9: "time_default". 2022-02-02 17:18:15 raspberrypi root[2276] INFO Imported plugin 10: "sunrise". 2022-02-02 17:18:15 raspberrypi root[2276] INFO Imported plugin 11: "snake". 2022-02-02 17:18:15 raspberrypi root[2276] INFO Imported plugin 12: "ip_address". 2022-02-02 17:18:15 raspberrypi root[2276] INFO Imported plugin 13: "time_matrix".

poa0314 commented 2 years ago

Problem solved! It was a bad soldering that caused the problem.

phenze commented 2 years ago

Unfortunately that is most of the time the problem.