├── LICENSE ├── project_ar.ino └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 xeift.eth 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /project_ar.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | #define SCREEN_WIDTH 128 // OLED display width 10 | #define SCREEN_HEIGHT 64 // OLED display height 11 | #define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) 12 | Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); // Declaration for SSD1306 13 | 14 | const char* ssid = "Xeift"; 15 | const char* password = "13241324"; 16 | 17 | void setup() { 18 | Serial.begin(9600); 19 | display.begin(SSD1306_SWITCHCAPVCC, 0x3C); 20 | delay(2000); 21 | display.clearDisplay(); 22 | display.setTextColor(WHITE); 23 | 24 | // Connect to Wi-Fi 25 | display.setTextSize(2); 26 | display.setCursor(0, 0); 27 | display.print("Connecting to: "); 28 | display.println(ssid); 29 | display.display(); 30 | WiFi.begin(ssid, password); 31 | 32 | while (WiFi.status() != WL_CONNECTED) { 33 | delay(500); 34 | Serial.print("."); 35 | display.print("."); 36 | display.display(); 37 | } 38 | 39 | display.clearDisplay(); 40 | display.setTextSize(1); 41 | display.setCursor(0, 0); 42 | display.print("Connected, "); 43 | display.println("IP: "); 44 | display.println(WiFi.localIP()); 45 | display.print("Ready to display =w="); 46 | display.display(); 47 | } 48 | 49 | void loop() { 50 | String btcPrice = sendGetRequestAndParsePrice("BTC"); 51 | delay(3000); 52 | 53 | String ethPrice = sendGetRequestAndParsePrice("ETH"); 54 | delay(3000); 55 | 56 | String bnbPrice = sendGetRequestAndParsePrice("BNB"); 57 | delay(3000); 58 | 59 | display.clearDisplay(); 60 | display.setTextSize(2); 61 | display.setCursor(0, 0); 62 | display.print("BTC:" + btcPrice + "\n"); 63 | display.print("ETH:" + ethPrice + "\n"); 64 | display.print("BNB:" + bnbPrice + "\n"); 65 | display.display(); 66 | } 67 | 68 | String sendGetRequestAndParsePrice(String tokenName) { 69 | HTTPClient http; 70 | http.begin("https://data-api.binance.vision/api/v3/ticker/price?symbol=" + tokenName + "USDT"); 71 | int httpCode = http.GET(); 72 | 73 | if (httpCode > 0) { 74 | String payload = http.getString(); 75 | http.end(); 76 | DynamicJsonDocument doc(1024); 77 | deserializeJson(doc, payload); 78 | double price = doc["price"]; 79 | int roundedPrice = (int) round(price); 80 | return String(roundedPrice); 81 | } 82 | else { 83 | http.end(); 84 | return "-1.0"; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Arduino-Crypto-Glass 2 | An projection glass that display realtime crypto price using Seeed Studio XIAO ESP32C3. 3 | 4 | # Credits 5 | This is not an original project. The main inspiration for this project comes from [Alain's Projects](https://www.instructables.com/Arduino-Data-Glasses-for-My-Multimeter/). However, I change some part, e.g. I use Fresnel lens instead of magnifying glass; use Seeed Studio XIAO ESP32C3 instead of Arduino Pro Micro. 6 | 7 | # Result 8 | ![glass](https://github.com/Xeift/Arduino-Crypto-Glass/assets/80938768/701e33d3-ed5c-4b7d-ba32-8e481aa57b82) 9 | Display BTC, ETH, BNB realtime price. 10 | 11 | # Hardware and Tools 12 | | Tool | Price | Link to the shop | 13 | | -------------------------- | ----------------- | -------------------- | 14 | | Seeed Studio XIAO ESP32C3 | 4.99 USD | [link](https://www.seeedstudio.com/Seeed-XIAO-ESP32C3-p-5431.html) | 15 | | 0.96 inch OLED display | 196 TWD (6.53 USD) | [link](https://shopee.tw/%E3%80%90%E5%82%91%E6%A3%AE%E5%89%B5%E5%B7%A5%E3%80%910.96%E5%90%8B-OLED-128x64-%E4%BD%8E%E8%80%97%E9%9B%BB-%E9%AB%98%E8%A7%A3%E6%9E%90-%E5%8F%AF%E9%A1%AF%E7%A4%BA%E9%BB%9E%E9%99%A3%E5%9C%96-Arduino-%E9%80%81%E7%AF%84%E4%BE%8B%E7%A8%8B%E5%BC%8F-%E5%A4%A7%E5%8B%9DLCD-i.20917936.390571551?sp_atk=32cd96d6-f768-4b44-a4dc-7f2c103764c7&xptdk=32cd96d6-f768-4b44-a4dc-7f2c103764c7) | 16 | | 45mm * 45 mm * 2mm mirror | 50 TWD (1.66 USD) | [link](https://shopee.tw/HSIN-KO-%E5%8F%B0%E7%81%A3%E8%A3%BD-1.1mm-1.3mm-2mm-%E9%8A%80%E9%8F%A1-DIY-%E5%B9%B3%E9%9D%A2%E9%8F%A1-%E6%96%B9%E5%BD%A2-%E6%89%8B%E5%B7%A5%E8%97%9D-%E5%B0%8F%E6%96%B9%E9%8F%A1-%E8%A3%B8%E9%8F%A1%E7%89%87(2pcs%E8%A3%9D)-i.13542007.22770131123) | 17 | | 10cm focal Fresnel lens | 169 TWD (5.63 USD) | [link](https://shopee.tw/%F0%9F%8C%B8%E6%97%A5%E6%9C%AC%E8%A3%BD%F0%9F%8C%B8%E3%80%90I.L.K.%E3%80%913.5x-80x43mm-%E8%8F%B2%E6%B6%85%E7%88%BE%E8%B6%85%E8%BC%95%E8%96%84%E6%94%9C%E5%B8%B6%E5%9E%8B%E6%94%BE%E5%A4%A7%E9%8F%A1-%E5%90%8D%E7%89%87%E5%B0%BA%E5%AF%B8-018-AN-%E7%86%B1%E9%8A%B7%E4%BA%BA%E6%B0%A3%E5%B0%8F%E7%89%A9-i.6108602.576784496) | 18 | | glass cutter | 130 TWD (4.33 USD) | [link](https://www.seeedstudio.com/Seeed-XIAO-ESP32C3-p-5431.html](https://shopee.tw/%E3%80%8E%E6%A8%82%E8%B6%A3%E7%94%9F%E6%B4%BB%E3%80%8F%E6%97%A5%E5%BC%8F%E7%8E%BB%E7%92%83%E5%88%80-HTJ3-%E7%8E%BB%E7%92%83%E5%88%80-%E7%8E%BB%E7%92%83%E5%88%87%E5%89%B2%E5%88%80-%E7%8E%BB%E7%92%83%E5%88%80-%E5%A4%9A%E5%8A%9F%E8%83%BD-%E5%88%87%E5%89%B2%E5%B7%A5%E5%85%B7-%E9%87%91%E5%89%9B%E7%9F%B3%E7%8E%BB%E7%92%83%E5%88%80-%E9%87%91%E5%89%9B%E7%9F%B3-%E5%9C%93%E8%A6%8F%E5%88%80-i.481628583.12809748373)) | 19 | | Total |694.2 TWD (23.14 USD)| | 20 | 21 | # Board 22 | I use [Seeed Studio XIAO ESP32C3](https://wiki.seeedstudio.com/XIAO_ESP32C3_Getting_Started/). It's cheaper than Arduino nano/mini pro, have built-in bluetooth + Wi-Fi module and it'd super small. 23 | ![IMG_20240602_230647](https://github.com/Xeift/Arduino-Crypto-Glass/assets/80938768/82ee2573-f12a-41f4-a268-e6b783df9977) 24 | 25 | # Display 26 | I use 0.96 inch oled display. 27 | 28 | # Mirror and Glass Cutter 29 | I use 45mm * 45 mm * 2mm mirror. 30 | ![IMG_20240602_234804](https://github.com/Xeift/Arduino-Crypto-Glass/assets/80938768/4ed29f39-d51e-4217-a635-331b118c4f31) 31 | And glass cutter without kerosene. 32 | ![IMG_20240602_234914](https://github.com/Xeift/Arduino-Crypto-Glass/assets/80938768/814e51a8-ebc7-4a23-84c0-7820eb0e5f9a) 33 | 34 | # Lens 35 | I use Fresnel lens with 10cm focal. 36 | --------------------------------------------------------------------------------