Monday, November 24, 2025

New Automenorahs and Communications

OK, it has been years since I created the old Automenorahs, which were designed mostly for Hannukah (as Hannukias). As time went on, I decided I wanted to do more with them to be able to use them throughout the year. In the Jewish religion, the Menorah is actually a religious strudture with 7 lights and is usually lit on religious holidays. Also, there are the two candles which are lit on every Shabbat (starting Friday night and continuing until Saturday night). So, I decided to expand threir programming to lights two lights each Shabbat and 7 lights each Jewish Holiday other than Hannukah and Shabbat. This required me to do two things. The first was to be able to accurately set the time and date and have the Automenorah maintain its accuracy over long periods. The clock chip was fine but it had to be programmed initally and then hope it would remain accurate. I found this to m=not neccessarily be the truth. I found that Arduino was starting to make some chips with wifi and bluetooth capabilities. Some of them were even smaller than the Arduino Uno boards I had been using. I also found they had on board 3.3VDC supply outputs and I could use this to supply current to the led lights without and external circuitry. I started experimenting with the wifi code and was able to get the current time and date from an online NPT server and query a Google server for time zone and DST information. This made it possible to program the Arduino to get the current time and date info on start up and use its internal clock to maintain this, allowing a resync with the internet at regular intervals (once an hour). The other thing I needed was a Hebrew lunar calendar to tell me when the holidays occurred. Shabbat was easy because it was just once a week on Friday but Rosh Hashana, Purim, Yom Kipper, etc was a different story. Went looking for software and was able to get a Gregorian to Hebrew conversion working so I could tell when the holidays start and end. Another thing I wanted to accomplish was to be able to create a dashboard app for my phone that would show me that the AutoMenorahs were working, maintaining acurrate time and tracking the holidays. I also wanted to make it possible to send information to the devices to set a "lights out" time which would allow lighting over night to be at a minimum and to set other parameters like the length of certain holidays. I had tried simple serial communications but this required the device be plugged into the computer. I also tried the Arduino Cloud with mixed results. Although II cannot remember why right now, I decided that was not going to work. Eventually I became aware of MQTT communications and, through much experimentation, was able to get the devices to work with my Android phone. I used a free test server called "test.mosquitto.org" for the broker of the messages back and forth. This worked well except that the server seemed to have frequent outages, usually on weekends. I had also come across HiveMQ, which had a free option but the communication protocals were different and somewhat escaped me for a while. In the meantime, I had started experimenting with a digital rain gauge based on my Ambient Weather Station I had had for several years. I wanted to display its rain output in a conspicuous display on an old tablet. This was pretty easy but I also decided to add MQTT to it as well to communicate with another rain gauge app on the Windows Desktop. It keped rain totals beyond what the Ambient Weather system did. It only kept totals up to the month and I also wanted to keep yearly and seasonal totals. The desktop app kept that stuff in a file and distrubuted it to the tablet for display and also to another app on my Android phone that displayed rain totals for the entire year by month and season. I finally spent some time with the HiveMQ server and the code changes I needed to work with it. I had to understand certificates and why the were important and how to incorporate them into my code. now that is all working with the Automenorahs and the Rain Gauge. I also created a cute little LEGO Menorah that uses the same code with an Arduino ESP32. I had also been thinking about IoT capabilities to be able to take a completely new Automenorah and to be able to set it up in a new location with a foreign internet connection in a different time zone with different DST requirements. After installing some IoT devices in my house I thought I had an understanding of how it should work. So I used the Bluetooth LE connection on the ESP32 to set up an inital connection and give the device the credentials it needed to connect to the intenet and the location information (City and State). I ended up also working with some ESP6822s that did not have Bluetooth LE but I nade them work using wifi communications.

No comments: