{"id":20483456,"url":"https://github.com/styczynski/avr-weather-esp8266","last_synced_at":"2026-03-06T06:31:57.944Z","repository":{"id":79817315,"uuid":"94831166","full_name":"styczynski/avr-weather-esp8266","owner":"styczynski","description":"Weather fetching through wifi with LCD1602 + Atmega32 + ESP8266","archived":false,"fork":false,"pushed_at":"2018-02-13T16:43:56.000Z","size":10225,"stargazers_count":16,"open_issues_count":0,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-26T11:45:21.884Z","etag":null,"topics":["arduino","atmega","avr","esp01","esp8266","iot","lcd1602","wifi"],"latest_commit_sha":null,"homepage":"http://styczynski.in/avr-weather-esp8266/","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/styczynski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2017-06-20T00:04:21.000Z","updated_at":"2024-03-11T04:46:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"36ed42de-d497-4b1f-a6b4-4d9ec72d9919","html_url":"https://github.com/styczynski/avr-weather-esp8266","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/styczynski/avr-weather-esp8266","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Favr-weather-esp8266","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Favr-weather-esp8266/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Favr-weather-esp8266/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Favr-weather-esp8266/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/styczynski","download_url":"https://codeload.github.com/styczynski/avr-weather-esp8266/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styczynski%2Favr-weather-esp8266/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30164594,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T04:43:31.446Z","status":"ssl_error","status_checked_at":"2026-03-06T04:40:30.133Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["arduino","atmega","avr","esp01","esp8266","iot","lcd1602","wifi"],"created_at":"2024-11-15T16:17:24.807Z","updated_at":"2026-03-06T06:31:57.909Z","avatar_url":"https://github.com/styczynski.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Weather fetching on Atmega32 + ESP8266 + LCD1602\n\n### About\n\n[See the full docs!](http://styczynski.in/avr-weather-esp8266/)\n[And also see this on git!](https://github.com/isis97/avr-weather-esp8266)\n\n\n![Video](http://styczynski.in/avr-weather-esp8266/view.gif)\n\n### Short description\n\nThis project tends to implement:\n\n* ESP8266 module messaging from AVR controller\n* Basic Http request + JSON parsing\n* LCD support\n\n### Why it has been made?\n\nBecause of the microcontroller exercises we did on our studies.\n\n### What does it do?\n\n* Boots up (if you press any key) the avr enters\n\n`settings mode` and asks for wifi creditentials\n\n* If no key was pressed during boot then normal procedure takes place\n\n* AVR tries to connect to the wifi\n\n* Then connects to `openweathermap.com`\n\n* Asks politely for weather data for `Warsaw`\n\n* Then fetches `JSON` with the most trivial ways\n\n* Displays the data\n\n* And sometimes refreshes the collected data :)\n\n### Pinout\n\n#### Main wirings\n\nThe AVR connections are basic and listed below:\n\n```javascript\n\n'ATMEGA32'   PA0 -\u003e D4   'LCD'\n'ATMEGA32'   PA1 -\u003e D5   'LCD'\n'ATMEGA32'   PA2 -\u003e D6   'LCD'\n'ATMEGA32'   PA3 -\u003e D7   'LCD'\n'ATMEGA32'   PA4 -\u003e RS   'LCD'\n'ATMEGA32'   PA5 -\u003e RW   'LCD'\n'ATMEGA32'   PA6 -\u003e E    'LCD'\n'ATMEGA32'   RXD -\u003e TX   'ESP8266'\n'ATMEGA32'   TXD -\u003e RX   'ESP8266'\n'ESP8266'    EN  -\u003e VCC  'ESP8266'\n\n```\n\nAnd of course `V0`, `VCC`, `GND`, `VSS`, `VDD`, `A`, `K` but they are trivial.\n\n#### Buttons\n\nAnd not mentioned in layout two buttons for settings screen:\n\n```javascript\n\n'ATMEGA32'  PD6  -(BUTTON)-\u003e  GND\n'ATMEGA32'  PD7  -(BUTTON)-\u003e  GND\n\n```\n\n\nIn settings mode:\n\n* `PD6` is used have next character functionality.\n\n* `PD7` changes current character.\n\nSchematic of connections (pretty small - try to enlarge with zooming hand):\n\n![Scheme](http://styczynski.in/avr-weather-esp8266/scheme.svg)\n\n**Notice:**\n\n*The `ESP8266` module was connected to the `5V USB` plug.\nThe module is designed to work for 3V but working on higher\nvoltage is possible (as demonstrated in this case).*\n\n*It's straightforward method and in normal conidtions\nyou should redesign scheme a little and provide 3V voltage source\nfor your wifi module.*\n\n*You will probably need logic level shifting\nform `5V (atemga)` to `3V (esp8266)` or you can just run atmega on 3V\n(notice that LCD needs standard 5V anyway!)*\n\n\n#### Mounting\n\nYou can mount the wires propably on pcb plate I used universal brakboard\nthat does not require soldering but it's rather a messy pile of cables, huh!\n\n\n### About building\n\n#### Build process\n\n**Warnning!**\n\n*Before building make sure all it's configured correctly (see configuration for more details)!*\n\nTo build the project do the following:\n\n* Create release folder e.g. `mkdir release`\n\n* Go into that folder `cd release`\n\n* Run CMAKE to generate needed makefiles `cmake ..`\n\n* Build app using make `make`\n\n* Optionally update documentation throught `make doc`\n\n* Optionally setup manually the needed fuse bits using `avrdude`!\n\n* Flash controller with `make upload`\n\n* Optionally clean build with `make clean`\n\n\n#### Configuration\n\nBefore continouing make sure that `USSID` and `PASSWD` Variables\nin `src/main.c` are configured to use with your wifi access point.\n\nThen make sure that `APIKEY` in line with `wifi_send` is matching\napikey for your openweathermap account.\nAnd the url is for location desired by you.\nSee `openweathermap api documentation` for more details :)\n\n\nThe main controller config is placed in `CMakeLists.txt` file.\n\nPlease change these as you wish:\n\n```bash\n# Variables regarding the AVR chip\nset(MCU   atmega32)\nset(F_CPU 8000000)\nset(BAUD  9600)\nset(PROG_TYPE usbasp)\nset(PROG_ARGS )\n```\n\n\n`BAUD` is not really needed and `PROG_ARGS` are additional paramters for avrdude.\n\n\n\nBasic example config for `Atmega328P-PU` running (by default) at 1MHz:\n\n```bash\n# Variables regarding the AVR chip\nset(MCU   atmega328p)\nset(F_CPU 1000000)\nset(BAUD  2400)\nset(PROG_TYPE usbasp)\nset(PROG_ARGS )\n```\n\n### Some source code\n\nThis snippet presents piece of source code from `main.c`\n(and is good introduction to the project insides as well as wifi.h module):\n\n```cpp\n\n// Handle ESP8266 events\nvoid wifi_event_handler(int event, const char* input, const int len) {\n\n  switch(event) {\n    case WIFI_EVENT_ANY: {\n       //\n       // You can display the input\n       // To provide debug info\n       // This kind of event (ANY)\n       // is called for any event\n       //\n       return;\n    } break;\n\n    case WIFI_EVENT_ERROR: {\n       // We got error!\n    } break;\n\n    // ESP8266 is not responding\n    case WIFI_EVENT_TIMEOUT: {\n       // We got timeout!\n    } break;\n\n    // Wifi was connected\n    case WIFI_EVENT_WIFI_CONNECTED: {\n       // We are conneted to the access point!\n    } break;\n\n    // Wifi was disconnected\n    case WIFI_EVENT_WIFI_DISCONNECTED: {\n       // We are disconneted to the access point!\n    } break;\n\n    // Connect to host\n    case WIFI_EVENT_CONNECTED: {\n       // We are connected to the ip/url specified earlier throug wifi_link_open\n    } break;\n\n    // Host sends data\n    case WIFI_EVENT_DATA: {\n      //\n      // Look for JSON data in response\n      //\n      search_json(weather_descr, input, \"description\");\n      search_json(weather_name, input, \"name\");\n\n      search_json(weather_data_buf, input, \"humidity\");\n      sscanf(weather_data_buf, \"%lf\", \u0026weather_humidity);\n\n      search_json(weather_data_buf, input, \"pressure\");\n      sscanf(weather_data_buf, \"%d\", \u0026weather_pressure);\n\n      search_json(weather_data_buf, input, \"temp\");\n      sscanf(weather_data_buf, \"%lf\", \u0026weather_temp);\n\n\n      // We do not need this connection anymore\n      wifi_link_close();\n\n      // Format received data\n      sprintf(info1, \"%s Weather:\", weather_name);\n      sprintf(info2, \"%s | Temp: %.1lf C | Humidity: %.0lf %% | Pressure: %d HPa\", weather_name, weather_temp-273.15, weather_humidity, weather_pressure );\n\n      //\n      // Display data continously in text shifting manner\n      //  \n      int shift = 0;\n      const int info_len = strlen(info2);\n      int cycles = 0;\n\n      while(1) {\n         lcd_clrscr();\n         lcd_gotoxy(0, 0);\n\t       lcd_nputs(info1, 16);\n\t       lcd_gotoxy(0, 1);\n\t       lcd_nputs(info2+shift, 16);\n\t       _delay_ms(500);\n\t       ++shift;\n\t       if(shift \u003e info_len - 4) {\n             shift = 0;\n             ++cycles;   \n         }\n         //\n         // End - return to main and then prepare next fetch request\n         //\n         if(cycles \u003e 15) break;\n      }\n\n      lcd_nputs(\"Update...\", 16);\n      lcd_clrscr();\n    } break;\n  }\n}\n\n\nint main(void) {\n\n  // Init UART\n  uart_init(UART_BAUD_SELECT(2400, F_CPU));\n\n  // Init buttons\n\n  //\n  // ...\n  //\n\n  // Init LCD\n  lcd_init(LCD_DISP_ON);\n\tlcd_gotoxy(0, 0);\n\tlcd_clrscr();\n\n  // Init wifi and connect to the desired network\n  lcd_clrscr();\n  lcd_puts(\"Initializing...\");\n  _delay_ms(1000);\n  wifi_init();\n\n  //\n  // Check if any button was pressed\n  // then go into settings mode :)\n  //\n\n  //\n  //  ...\n  //\n\n  //\n  //  Normal boot sequence\n  //\n  normal_boot:\n\n  // Display greeting on lcd\n  lcd_puts(\"Hello\");\n  _delay_ms(1000);\n  lcd_clrscr();\n  _delay_ms(1500);\n\n\n  lcd_clrscr();\n  lcd_puts(\"Conecting...\");\n  _delay_ms(1000);\n\n  //\n  // Display USSID/PASSWD data on the screen\n  //\n  lcd_clrscr();\n  lcd_puts(\"ID: \");\n  lcd_puts(USSID);\n  lcd_puts(\"\\nPASS: \");\n  lcd_puts(PASSWD);\n  _delay_ms(1500);\n\n  // Try to connect to the access point\n  wifi_connect(USSID, PASSWD);\n\n  while(1) {\n    // To make sure nothing dumb trash does not come\n    // through UART interface\n    uart_flush();\n\n    // Connect to openweathermap\n    wifi_link_open(\"TCP\", \"api.openweathermap.org\", 80);\n\n    // Request data from REST api\n    wifi_send(\"GET /data/2.5/weather?q=warsaw\u0026APPID=cf24c94ac2550178e2ea4e970cd0f416 HTTP/1.1\\r\\nHost: api.openweathermap.org\\r\\nConnection: keep-alive\\r\\nCache-Control: max-age=0\\r\\n\\r\\n\\r\\n\");\n\n    // Wifi functions will call wifi_event_handler function on any event (it's callback function)\n  }\n\n  return 0;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstyczynski%2Favr-weather-esp8266","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstyczynski%2Favr-weather-esp8266","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstyczynski%2Favr-weather-esp8266/lists"}