Building an Eclipse...
 
Notifications
Clear all

Building an Eclipse Light Logger with remote display

13 Posts
4 Users
2 Likes
194 Views
 John
(@jhb)
Member
Joined: 2 months ago
Posts: 12
Topic starter  

Hey all you helpful souls!  I'm working on a data logger to track light levels during the upcoming Solar Eclipse on April 8.  My logger will utilize 2 main parts.  1) The logger itself, using a Sparkfun IoT Redboard with a Sparkfun ISL29126 Light Sensor, and logging the levels using the on-board micro SD card slot.  This light sensor is cool because it outputs the red, blue, and green levels independently of each other.  The logger itself is probably pretty straightforward, but I want to drive a display (old 4 line x 20 character per line LCD) some distance (10-30') away.  This is so I can mount the sensor/logger somewhat high up so as to avoid changes due to people wandering around in front of it, and still be able to glance at the levels being at ground level.

I want the logger to be 100% reliable (99% would be acceptable), regardless of how well the display piece works, and maybe not even connected.  What do you folks think would be a good way to communicate the real-time level information from the logger to the display?  Given an ESP32 at each end, Bluetooth, WiFi, or serial are available.  (I have to assume that no WiFi will be available other than what I could provide with either ESP32.)

1) I could probably rig up a Bluetooth connection using the BT Serial Port Profile, but I've not used BT on the ESP32.  The ends would have to pair and connect automatically in the field, though I could do some setup before hand with a PC.

2) Similar story with Wi-Fi, I haven't used it on ESP32 very much.  I'm preferring this method, if I could get it to work in this way:  I'm thinking the sensor end could be configured as an Access Point, and continually broadcast UDP packets to the nearby receiving device.  The receiving device, could always listen for UDP packets from the AP, and use a transfer protocol I'll make up, this whole think also behaving like a serial link.  As a bonus, by using WiFi, maybe other friends' devices could also receive the messages.

3) Lastly, wire them together with their UARTs.  Gasp, I've been using serial ports for 50+ years, with the only advance being that these would use TTL levels!

Other considerations:  a) I expect that everything will be battery powered, so that would favor UARTs.  b) I'd like the data flow to be bidirectional, so the display device (with a few switches) could send messages to the logger to configure the sensor's sensitivity, etc.

Finally, I'll willingly consider any other suggestions, no matter how off-the-wall they may be.  For those who would say, "Forget the distraction of the widgets and electronics, and just be in the moment with the eclipse", I've already thought of that.  That's why I want the logger to be 99% reliable, so it can be out-of-sight and out-of-mind.  I did similar logging of the eclipse of Aug. 2017, from a hilltop at John Day, Oregon.  All worked well with the logging, using a laptop powered from the car.  The only downside was that when all was over, after several hours, the car wouldn't start!  All my projects are power mongers.

Thanks for any help and thoughts!  -- John

P.S., this is practically my first post; I hope it goes to the "Help Wanted" topic in Project Corner.

This topic was modified 1 month ago by John

   
Quote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6981
 

@jhb I would use WiFi, longer range and more reliable. As far as battery, either sleep between observations and/or use either a power bank, or a large enough RC type battery, but the battery plus charger will set you back a few hundred. There is NO such thing as a safe cheap charger. A couple of $50 power banks seems like a better idea.

Good luck, you don't have much time.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Mac-in-Memphis
(@mac-in-memphis)
Member
Joined: 2 years ago
Posts: 8
 

Hello John, Were you able to assemble & run your project? Curious minds would love to see your data!

Mac

If it is broken, anyway; then just take it completely apart and try to fix it.
you may learn something valuable from the ancient efforts of industrious others. /hms


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6981
 

@mac-in-memphis He posted that on Mar 13. He was last on the forum Mar 14. I would assume he either ran out of time or couldn't figure it out.

Many/most folks do not provide closure. They either just walk away and are seldom seen again, or they just change topics.

Don't hold your breath waiting to see the data.

FYI When you want to speak to a specific individual or post, use the Reply link at the bottom right of the post you are replying to and/or if you want to speak or CC a specific person, use the @nickname format (it is displayed in the member info)

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
 John
(@jhb)
Member
Joined: 2 months ago
Posts: 12
Topic starter  

@zander, you said, "I would assume he either ran out of time or couldn't figure it out." Please do not speak on my behalf. Your response was premature, offensive (to me, the OP), and not at all helpful. It is appalling that you would publish a public post criticizing my lack of responsiveness a mere 49 MINUTES after the question was posted! The world is better off without critical and cynical posts. The eclipse was on Monday, and I was on vacation in Arkansas (from Oregon), enjoying time with good friends. My priority was being mindful of my time there, enjoying the eclipse, having fun etc. I fully intend to provide a detailed discussion of my project, complete with data, after settling in back at home.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6981
 

@jhb 49 minutes??? from 3-13 928pm to 4-10 1211 is more like 3+ weeks.

As I am autistic, I am often guilty of 'tonal' errors. 

Sorry my skull was severely damaged at birth resulting in this behaviour, there is not a lot I can do to stop it. I am getting better, at one time at parties etc I would tell women their dress made them look fat. I hardly ever do that anymore.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6981
 

Posted by: @jhb

@zander, you said, "I would assume he either ran out of time or couldn't figure it out." Please do not speak on my behalf. Your response was premature, offensive (to me, the OP), and not at all helpful. It is appalling that you would publish a public post criticizing my lack of responsiveness a mere 49 MINUTES after the question was posted! The world is better off without critical and cynical posts. The eclipse was on Monday, and I was on vacation in Arkansas (from Oregon), enjoying time with good friends. My priority was being mindful of my time there, enjoying the eclipse, having fun etc. I fully intend to provide a detailed discussion of my project, complete with data, after settling in back at home.

Your feedback prompted me to see if an AI could improve my writing skills. I put my post that you objected to into CHATGPT and this is how it wrote it. Let me know if this is better.

It seems like the individual may have encountered some difficulties or time constraints. It's common for people to move on without providing closure or follow-up. Instead of waiting for the data, it might be more productive to explore other avenues.

Just a heads-up, if you want to address someone directly or refer to a specific post, it's helpful to use the "Reply" link at the bottom right of the post. Additionally, you can mention or tag a specific person using the @nickname format, which can be found in their member info.

Of course now I need to remember to use it. That may sound strange to you, but I have a horrible time remembering some things. It's all a part of the brain damage.

BTW, I am looking forward to the results of your Eclipse Light Logger.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2532
 

Posted by: @jhb

"I would assume he either ran out of time or couldn't figure it out." Please do not speak on my behalf. Your response was premature, offensive (to me, the OP), and not at all helpful.

I think you should take a little time and think about this from a general point of view.

You're lashing out at the only person who gave you any substantive help/advice on the original post, and he responded in about half an hour. So we see that he's already been of help to you.

You'll notice that Ron has over 6800 posts and you have 9, so we can conclude that Ron has had YEARS more experience with the forum and members' (new and longterm) behaviour than you. Since we expect him to supply his knowledge and experience of electronics and phenomena like WIFI and so on to the forum, it's a natural extension to expect him to also offer opinions on the behaviour of forum members.

If you take time to scan the forum's history, you will find that there are several members who have been active for years and shared their information and opinions and asked for help on many topics. They are the minority, most users post a few times and disappear into the mist. 

Many of the 'regulars' would assume that a thread is stale after a couple of weeks have passed and the OP hasn't expanded or replied to any responses provided, so there's nothing surprising about his comment. In fact he specifically says "I would assume" and then gives the two most likely reasons for the lack of response from the OP. That means that it's based on his experience in the forum, not some desire to denigrate you personally.

He doesn't specifically cast any aspersions on your character, motives nor ability; he just points out that this is likely a dead thread so the other poster won't feel bad if there's no response to his question.

If you choose to provide the details of your creation and share the results of its operation, then thank you on behalf of the forum. It is of no interest to me personally but both Mac-in-Memphis and Ron have expressed an interest in your project.

My point here is not to embarrass you or call you out in any way. I just want you to understand that the forum is intended to share the experiences and opinions of its members. Your opinion is quite valid, but please look at the larger picture of the forum and realize that while you feel that Ron has misjudged YOU that his opinion is equally valid in that it is totally in synch with what we very often see on the forum from newer members.

 

 

Anything seems possible when you don't know what you're talking about.


   
huckOhio reacted
ReplyQuote
 John
(@jhb)
Member
Joined: 2 months ago
Posts: 12
Topic starter  

The Eclipse Light Logger, 4/12/2024

Back home from Arkansas, unpacked, settled in, writing about the light logger project.

First of all, thanks to Ron, on this forum, and others, both online and offline, who made suggestions for the development of this project. As will be mentioned later, I settled on using WiFi instead of Bluetooth, partly because of the greater distance ability, but also because broadcasting UDP packets is a one-to-many layout, whereas Bluetooth is one-to-one.

In summary, everything went pretty well, the only issue was the sensitivity and dynamic range of the sensors was limited. Most of the readings before and after totality were maxed out at full scale.  One choice I made at eclipse time was whether to have the sensors in direct sunlight, or shade them from direct sun so they would pick up ambient light from the sky.  I opted for direct sunlight, thinking that would give better low-light sensitivity and and near totality.  Given the over-range of the sensors most of the time, that might not have been so good.  I still haven't decided if shaded might have been better; I could only pick one and will never know how the other choice would have worked out.

The sensing / logging unit was a Sparkfun ESP32 IoT Redboard, with onboard uSD card slot. It has an ISL29125 RGB sensor with 16-bit digitizer for each of the 3 colors, communicating with the ESP32 via I2C. The readout is directly in lux, approximately, for each color. Its 2 ranges are 0-375 lux and 0-10,000 lux. As a last-minute update, a day before the eclipse, I added auto-ranging to the RGB sensor to keep it in the best range for the trending light levels. There are also 2 light-dependent resistors (LDR), forming 2 voltage dividers going into 2 of the ADC1 inputs. For the nerdy details, one side of each LDR was tied to the 3.3V rail; one has a 20k resistor to ground (for high sensitivity, low light) and the other has a 3.3k resistor (low sensitivity high light). On reset, the code configures the ESP32 to WiFi Station mode. It connects to a defined access point provided by my cell phone, so it will work anywhere the phone has coverage, and sets its time via NTP. After getting the time, the code reconfigures the WiFi to be an AP. It then collects light level samples at 2 per second and stores the readings to a file on the uSD card. It also broadcasts a UDP packet in ASCII with the date, time, range, and all the readings. This unit was battery-operated via a USB power pack. Startup and ongoing logging is entirely automatic from power-on.

The monitor device is a Sparkfun ESP32 Thing Plus with an attached OLED display. It receives the UDP packets, parses them, and displays everything in text on the OLED display. This way I could glance at the monitor to verify that the time got set successfully, and occasionally verify that the logger is still sampling and running. This was powered by a 2000 mAH LiPo battery. I figured that both the logger and the monitor would run continuously for at least 10 hours or more with their supplied batteries; they both did run for 6 hours: 2 hours before the eclipse, 3 during, and 1 after.

For the August, 2017 total eclipse, I was in John Day, Oregon, and had a similar but way different setup. (What kind of stupid statement is that, you might wonder.) In 2017 I used a Beagle Bone Black computer. It had a single LDR with a 10k resistor to ground, and collected data at 1 sample per 10 seconds, which was a bit too slow at the transition into and out of totality. This arrangement lost some resolution at both the high and low light level ranges, but never maxed nor bottomed out. I think I misunderstood the max input to the ESP32 ADC in 2024, because the analog input was maxed out most of the time. I saw some reference that the input range was 0-1100mv though, when I experimented with a trim pot at 3.3V, I thought it worked OK at close to max. I tried (this time, in 2024) to output Vref to one of the GPIOs. That worked, but only when WiFi was off. As near as I could tell easily, Vref could only output to an ADC2 pin, but this conflicted with WiFi, which uses all the ADC2 GPIOs. The other big difference was that in 2017 I didn't log any numbers, but output an ASCII line graph with a blip somewhere between 1 and 150 characters indented from the left; in 2024 I logged only the numbers, so I had to massage the data in Excel to see any kind of trends.

Maybe I'll get it right in 2044, when I'm in my 90s!

As for the attached data, the logger logged 38,000+ samples between 10:20 AM and 4:00 PM (memory is cheap, right?). A sample line looks like this:

2024/04/08 10:19:56: LDR0:2800, LDR3:1893, rBlue:7562, rRed:5775, rGreen:7017, Blue:43.27, Red:33.05, Green:40.15, Scale:0

Left-to-right: Date, time, raw values (0-4095) for the High and Low sensitivity LDRs, raw values (0-65535) for the Blue, Red & Green RGB sensor, lux values for the RGB sensor, and the RGB sensor scale setting (0 means the low-sensitivity 0-10k lux range, 1 means the high sensitivity 0-375 lux range).

For the Excel spreadsheet I only included the portion with "interesting" data, excluding the beginning and ending values where all sensors were maxed out. This is from 1:32 PM to 2:06 PM, with darkest being around 1:53 PM, CDT, at Fairfield Bay, Arkansas. In Excel I added 2 columns to normalize the LDR 0-4095 values to be in the 0-10,000 range like the RGB lux values. A lot can be done to pretty-up the Excel chart, but what is attached is a good start. If you want, feel free to grab the raw log file and massage it to your heart's content. And, just for historical purposes, since it's easy to come by, I included the log from the 2017 eclipse as well.

 


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6981
 

@jhb Very interesting. 

I thought the edge phenomena might result in some higher (dangerous? values) but maybe more sensitive and higher dynamic range is required.

If you are around for the next one, what do you think of another set of sensors behind a piece of solar shielding. Then some interesting graphs could be made of the two sets of data.

While you are at it, maybe adding a set of ambient sensors would also be of interest.

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
 John
(@jhb)
Member
Joined: 2 months ago
Posts: 12
Topic starter  

Good questions and comments, all.

By "dangerous values", I assume you mean potentially harmful levels to the ADC input(s) of the ESP32? I have seen 2 conflicting ideas about what the max input is for ADC1. An Arduino forum had an example of a variable pot between the 3.3V rail and ground, with the wiper going to an ADC input. This example used analogRead(channel) to get the value. When I tried that, most of the range of the pot gave linear output at the ADC output. Only at the extreme bottom and top of the pot's range did the ADC bottom out and max out. So I assumed that my resistive divider from 3.3V to ground would work well. I also saw some Espressif documentation saying that Vref was nominally 1100 mV, implying that the ADC would max out near that (Vref) level.

There was an Espressif example that used adc1_get_raw(channel)to read the values. Espressif APIs include adc1_config_channel_attn(), and esp_adc_cal_characterize(). There is also esp_adc_cal_raw_to_voltage(). Probably all these APIs work together in some way. It was not clear how the ADC uses the attenuation setting. It could be used internally to configure ADC hardware, possibly affecting the allowable input range. Or it could be used to tell the esp_adc_cal_raw_to_voltage() function about external attenuation so it (the function) can compensate for it (the external attenuation)? Or both. Or neither! Anyway, I used my 3.3V-to-ground divider, and analogRead(). It now looks like that may have been over-driving the ADC input. I also experimented with the Espressif API adc2_vref_to_gpio(), which worked well during testing. But when integrated into the project with WiFi turned on, then the adc2_vref_to_gpio() function always failed.

For the next eclipse in 2044, I'll probably be watching that from the heavens above (or maybe from the hell below). However, if I am still on this earth, I'm certain that technology will have evolved to a state that is unpredictable today. Maybe the optical sensors will have infinite dynamic range, with frequency ranges from DC to Xray, in buckets of programmable width. OK, maybe the wavelength range will be only IR to UV, in 50 nm wide buckets, and maybe not quite infinite dynamic range. And, if the consumer-grade sensors of this type are available and reasonably priced, then I'll use 2 sensors. One in direct sunlight, and another with a shade just large enough to keep the direct sunlight off the sensor, while occluding only the smallest fraction of the sky. We'll just have to wait and see!


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6981
 

@jhb Sorry I wasn't clear, I was talking about people watching the total phase without any protection. Totality does NOT take into account flares and other solar events that may give off dangerous levels of various frequencies. Getting the glasses back on a few seconds before totality ends is critical as your data showed when the readings jumped over a magnitude in less than 1 second.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
 John
(@jhb)
Member
Joined: 2 months ago
Posts: 12
Topic starter  

Now that the eclipse is over, it's time to complete the "Scientific Method". That is, what would one expect to happen? What should the brightness curves look like?

Most basically, and ideally, you start with (what appears to be) 2 same-sized circles / disks in a plane, such that their centers are 2r apart.  I.e., the outer circumferences of each are going to touch in the next instant.  Let's call S the Sun, and be stationary, for this discussion, and M be the moon, and it will be the moving disk.  Also assume the center of M is moving straight toward the center of S and continues its straight path until the centers are 2r apart on the opposite side. What I'd want to know (at least, what I think I'd like to know) is the formula to determine how much of S is occluded by M at any time between start and end.

This simplification pretends the size of the 2 disks are the same, which would mean 0 time of totality. For those whizzes who care about preciseness, we know that, for this eclipse, the Moon disk is slightly larger than the Sun disk, the maximum time of totality was 4:15 (m:ss), and the total time from beginning to end of any occlusion was 2:38 (h:mm).  (At Fairfield Fay, Arkansas.)  So, generally, given disks of r1 and r2 radii, with centers at a distance d apart, and disk 1 on top of disk 2, how much of disk 2 is visible?

Next question, are light levels and lux units linear or logarithmic?  If the Sun is 50% hidden by the moon, is it correct to say that the light level is 3dB lower? And if the Sun is 90% hidden, the light level is 10 dB lower?  And 99.9% equates to 30 dB?  And, assuming an arbitrary reference of 100,000 lux, is 10,000 lux 1/10th as powerful, down 10 dB?

Ah, so many questions. Thanks for any answers.


   
ReplyQuote