{"id":39949883,"url":"https://github.com/andy4495/solar_data_logger","last_synced_at":"2026-01-18T20:15:58.660Z","repository":{"id":202685333,"uuid":"707919211","full_name":"Andy4495/solar_data_logger","owner":"Andy4495","description":"Sketch to take voltage measurements at regular intervals and store the data in non-volatile internal FRAM.","archived":false,"fork":false,"pushed_at":"2025-09-16T21:53:41.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-17T00:03:12.165Z","etag":null,"topics":["fram","msp430","solar"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Andy4495.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-10-21T01:31:08.000Z","updated_at":"2025-09-16T21:53:45.000Z","dependencies_parsed_at":"2023-12-13T05:04:23.707Z","dependency_job_id":"3995f827-67e3-40ef-ae95-118ea44edb4a","html_url":"https://github.com/Andy4495/solar_data_logger","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"c6d5745c2a007a035a2bf98b5963426d73785a35"},"previous_names":["andy4495/solar_data_logger"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Andy4495/solar_data_logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Andy4495%2Fsolar_data_logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Andy4495%2Fsolar_data_logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Andy4495%2Fsolar_data_logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Andy4495%2Fsolar_data_logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Andy4495","download_url":"https://codeload.github.com/Andy4495/solar_data_logger/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Andy4495%2Fsolar_data_logger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28549753,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T19:56:05.265Z","status":"ssl_error","status_checked_at":"2026-01-18T19:55:54.685Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fram","msp430","solar"],"created_at":"2026-01-18T20:15:58.598Z","updated_at":"2026-01-18T20:15:58.653Z","avatar_url":"https://github.com/Andy4495.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Solar Data Logger\n\n[![Arduino Compile Sketches](https://github.com/Andy4495/solar_data_logger/actions/workflows/arduino-compile-sketches.yml/badge.svg)](https://github.com/Andy4495/solar_data_logger/actions/workflows/arduino-compile-sketches.yml)\n[![Check Markdown Links](https://github.com/Andy4495/solar_data_logger/actions/workflows/check-links.yml/badge.svg)](https://github.com/Andy4495/solar_data_logger/actions/workflows/check-links.yml)\n\nThis sketch takes voltage measurements at regular intervals and stores the data in non-volatile internal [FRAM][4].\n\nThe sketch was designed specically for use with an [MSP430FR2433 LaunchPad][5] powered with a solar panel, but could be adapted to other boards (particularly other \"FR\" variants of the MSP430) and other power sources or data collection needs.\n\nThe MspTandV [library][1] is used to get calibrated measurements of $V_{cc}$ and an analog input pin using the MSP430's internal voltage reference. I use the analog input to measure the raw solar cell voltage output through a resistor divider.\n\nBy storing the data in FRAM, the sketch can be run without being connected to a computer and the data can be retrieved at a later time.\n\nThe sketch has been tested on the FR2433 variant and should work on other FR variants supported by the [MspTandV][1] library (FR4133, FR6989, FR5969).\n\n## Configuration\n\nThe sketch has several `#define` statements that can be updated to fit the project's needs:\n\n| Parameter            | Default Value | Description |\n| -------------------- | ------------- | ----------- |\n| `LOOP_TIME`          | 60000UL       | Time in ms between voltage readings. |\n| `LED_TIME`           | 3000UL        | Time in ms between LED toggling  on and off. |\n| `SAMPLE_COUNT`       | 1536          | Number of samples stored in FRAM. Each sample takes 4 bytes. |\n| `REBOOT_DETECTED`    | 5555          | Value to store when board is rebooted without clearing previously stored data. |\n| `V_DIV_SCALE_FACTOR` | 0.24605       | Scaling factor from the voltage divider. See below. |\n| `RAW_ADC_PIN`        | 5             | Analog pin used to measure the raw voltage (typically through a voltage divider). |\n| `LED_PWM_LEVEL`      | 32            | Controls LED brightness (0 to 255). Higher is brighter and uses more current. |\n\nThe `V_DIV_SCALE_FACTOR` is used to calculate an actual voltage when the calibrated ADC reading is measured using a voltage divider:\n\n$$\nV_{Calculated} =  ADC_{Calibrated} \\times \\left(V_{ref} \\over ADC\\\\\\_STEPS \\right) \\div {V\\\\\\_DIV\\\\\\_SCALE\\\\\\_FACTOR}\n$$\n\n$ADC\\\\\\_STEPS$ and $V_{ref}$ are configured automatically with the MspTandV library.\n\n`V_DIV_SCALE_FACTOR` needs to be calculated specific to your setup:\n\n![image](https://upload.wikimedia.org/wikipedia/commons/2/21/Resistive_divider2.svg \"Image by Wikipedia user Krishnavedala CC0\")\n\n[//]: # (CC0: https://creativecommons.org/publicdomain/zero/1.0/deed.en)\n\n$V_{in}$ is the voltage you are trying to measure (i.e., $V_{Calculated}$)  \n$V_{out}$ is the analog input pin.  \n$R_1$ and $R_2$ should be measured with an accurate DMM.\n\nThen calculate and use the result to update `#define V_DIV_SCALE_FACTOR`:\n\n$$\n{V\\\\\\_DIV\\\\\\_SCALE\\\\\\_FACTOR} = { R_2 \\over ( R_1 + R_2 ) }\n$$\n\nFor example, if $R_1$ = 11920 Ohms and $R_2$ = 3890 Ohms, then `V_DIV_SCALE_FACTOR` should be set to 0.24605.\n\n## Operation\n\nHolding down PUSH1 at reboot prints to Serial the Vcc and calibrated ADC values stored in FRAM, along with the calculated voltage for each reading.\n\nHolding down PUSH2 at reboot clears the data store in FRAM. The LED is briefly flashed when FRAM is cleared.\n\nIf a reboot is detected (e.g., due to loss of power from the solar panel), then the `REBOOT_DETECTED` value is stored in the next data cell.\n\nThe LED is flashed every few seconds (per `LED_TIME` value). Since this takes a little extra power, it may be useful to remove the LED jumper after confirming that the program is running so that the measurements aren't affected by the LED current draw.\n\nTo connect a serial monitor to the logger without impacting the data collection:\n\n- Configure the Jumper Isolation Block (J101) with jumpers `GND` and `TXD\u003e\u003e` connected and the other jumpers (`5V`, `3V3`, `RXD\u003c\u003c`, `SBWTDIO`, `SBWTCK`) disconnected\n- Connect a PC via USB to the Debug Probe section\n\n## External Libraries\n\n- [MspTandV][1]\n\n## Implementation Details\n\nBy default, the FRAM is configured as read-only in the FR2433 variant, so there is a compiler directive to unlock it for write access. This is not needed for other supported FR variants. For more details, refer to the [issue in GitHub][47], the [MSPFRxx User Guide][2], and the Software section of the Embedded Computing FR2433 [article][3].\n\n## References\n\n- MspTandV [library][1]\n- MS430FR4xx and MSP430FR2xx Family [User Guide][2]\n- FRAM [FAQ][4] from Texas Instruments\n\n## License\n\nThe software and other files in this repository are released under what is commonly called the [MIT License][100]. See the file [`LICENSE.txt`][101] in this repository.\n\n[1]: https://github.com/Andy4495/MspTandV\n[2]: https://www.ti.com/lit/pdf/slau445\n[3]: https://embeddedcomputing.weebly.com/launchpad-msp430fr2433.html\n[4]: https://www.ti.com/lit/wp/slat151/slat151.pdf\n[5]: https://www.ti.com/tool/MSP-EXP430FR2433\n[47]: https://github.com/energia/msp430-lg-core/issues/47\n[100]: https://choosealicense.com/licenses/mit/\n[101]: ./LICENSE.txt\n[//]: # ([200]: https://github.com/Andy4495/Solar-Data-Logger)\n\n[//]: # (This is a way to hack a comment in Markdown. This will not be displayed when rendered.)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandy4495%2Fsolar_data_logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandy4495%2Fsolar_data_logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandy4495%2Fsolar_data_logger/lists"}