{"id":13800764,"url":"https://github.com/karlsoderby/upython-chat-gpt","last_synced_at":"2025-05-13T09:31:56.624Z","repository":{"id":172745418,"uuid":"649700485","full_name":"karlsoderby/upython-chat-gpt","owner":"karlsoderby","description":"ChatGPT for MicroPython","archived":false,"fork":false,"pushed_at":"2023-06-05T13:38:55.000Z","size":2795,"stargazers_count":18,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-22T12:32:51.388Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/karlsoderby.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-06-05T12:54:47.000Z","updated_at":"2024-03-24T06:55:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"da3b8788-a98e-48a1-b3c4-59d79dddb4e1","html_url":"https://github.com/karlsoderby/upython-chat-gpt","commit_stats":null,"previous_names":["karlsoderby/upython-chat-gpt"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karlsoderby%2Fupython-chat-gpt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karlsoderby%2Fupython-chat-gpt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karlsoderby%2Fupython-chat-gpt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karlsoderby%2Fupython-chat-gpt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karlsoderby","download_url":"https://codeload.github.com/karlsoderby/upython-chat-gpt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253913243,"owners_count":21983283,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-08-04T00:01:16.044Z","updated_at":"2025-05-13T09:31:53.076Z","avatar_url":"https://github.com/karlsoderby.png","language":"Python","readme":"# upython-chat-gpt\n\nChatGPT for MicroPython.\n\n![ChatGPT on a GIGA R1 WiFi](hero.png)\n\n## Overview\n\nThis repository contains an example that allows you to connect to ChatGPT using MicroPython. It makes a POST request to the OpenAI API with a question and receives a response that is then printed on an OLED display. \n\nThis example has been tested to work with the [Giga R1 WiFi](https://store.arduino.cc/products/giga-r1-wifi) board and a generic ESP32 board and should be compatible with other boards supporting MicroPython.\n\nTo connect to OpenAI, you will need an account with a payment plan as this is not a free service. However, you can play around with this for days without spending more than a dollar.\n\n## Hardware Requirements\n- [GIGA R1 WiFi](https://store.arduino.cc/products/giga-r1-wifi)\n- [OLED SSD1315 (I2C)](https://wiki.seeedstudio.com/Grove-OLED-Display-0.96-SSD1315/) display.*\n\n\\*Other similar OLED displays may work but have not yet been tested with this setup.\n\n## Hardware Setup\n\nWire the display to the GIGA R1 WiFi using the following chart:\n\n| GIGA R1 WiFi | OLED SSD1315 |\n| ------------ | ------------ |\n| SDA          | SDA          |\n| SCL          | SCL          |\n| GND          | GND          |\n| 5V           | VCC          |\n\n## Software Setup\n\n1. Install MicroPython on your board. To install on the GIGA R1 WiFi, follow [this guide](https://docs.arduino.cc/tutorials/giga-r1-wifi/giga-micropython).\n2. Install a MicroPython-compatible editor (like [Thonny](https://thonny.org/) or [Arduino Lab for MP](https://labs.arduino.cc/en/labs/micropython))\n3. Install the SSD1306 OLED driver on your board, either by installing directly via Thonny's built-in package manager or by copying over the `ssd1306.py` file in this repository to the `lib` folder of your board.\n4. Create an account with [OpenAI](https://openai.com/). Once created, you will need to register a credit card or another payment method. You should then be able to create an API key.\n5. In the example script, add your API key in the `api_key` field.\n6. In the example script, you will also need to add your WiFi network SSID + PASS.\n\nYou should now have met all the requirements to use the example script provided in this repository.\n\n## Usage\n\nWhen you have set it up properly, anytime you launch the script, the following will happen:\n- The content of `open_ai_question` is sent in a POST request to the OpenAI API, which will return a response. This uses the `urequests` \u0026 `ujson` modules. \n- The response is printed on the OLED display, letter by letter for extra dramatic effect.\\*\n\n\u003e\\*I couldn't find a text wrap function in the `ssd1306.py` module so I made a quick and dirty improvisation (the `print_oled()` function).","funding_links":[],"categories":["Libraries"],"sub_categories":["AI"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarlsoderby%2Fupython-chat-gpt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarlsoderby%2Fupython-chat-gpt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarlsoderby%2Fupython-chat-gpt/lists"}