{"id":7844,"date":"2026-04-18T21:16:27","date_gmt":"2026-04-18T21:16:27","guid":{"rendered":"https:\/\/hishamghanayem.com\/?p=7844"},"modified":"2026-04-18T21:17:54","modified_gmt":"2026-04-18T21:17:54","slug":"my-first-esp32-project-making-an-led-blink","status":"publish","type":"post","link":"https:\/\/hishamghanayem.com\/en\/uncategorized\/my-first-esp32-project-making-an-led-blink","title":{"rendered":"My First ESP32 Project: Making an LED Blink"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"7844\" class=\"elementor elementor-7844\" data-elementor-post-type=\"post\">\n\t\t\t\t<div class=\"elementor-element elementor-element-50af30d2 e-flex e-con-boxed e-con e-parent\" data-id=\"50af30d2\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-046275d elementor-widget elementor-widget-image\" data-id=\"046275d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"768\" height=\"1024\" src=\"https:\/\/hishamghanayem.com\/wp-content\/uploads\/2026\/04\/ESP32-Blink-Project-1-768x1024.jpeg\" class=\"attachment-large size-large wp-image-7845\" alt=\"ESP32 S3 microcontroller connected to LED on breadboard for blinking LED project\" srcset=\"https:\/\/hishamghanayem.com\/wp-content\/uploads\/2026\/04\/ESP32-Blink-Project-1-768x1024.jpeg 768w, https:\/\/hishamghanayem.com\/wp-content\/uploads\/2026\/04\/ESP32-Blink-Project-1-225x300.jpeg 225w, https:\/\/hishamghanayem.com\/wp-content\/uploads\/2026\/04\/ESP32-Blink-Project-1-1152x1536.jpeg 1152w, https:\/\/hishamghanayem.com\/wp-content\/uploads\/2026\/04\/ESP32-Blink-Project-1-9x12.jpeg 9w, https:\/\/hishamghanayem.com\/wp-content\/uploads\/2026\/04\/ESP32-Blink-Project-1.jpeg 1536w\" sizes=\"(max-width: 768px) 100vw, 768px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-450b0869 elementor-widget elementor-widget-text-editor\" data-id=\"450b0869\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\n<h2 style=\"font-size: 24px; font-weight: 600;\">Introduction<\/h2>\n\n<p>\nI recently started learning embedded systems and robotics using an ESP32-S3 starter kit.\nMy first project was to make an LED blink. Although it sounds simple, it turned out to be\na valuable introduction to how hardware and software interact.\n<\/p>\n\n<hr \/>\n\n<h2 style=\"font-size: 24px; font-weight: 600;\">The Goal<\/h2>\n\n<p>The objective of this project was:<\/p>\n\n<ul>\n  <li>Connect an LED to the ESP32<\/li>\n  <li>Write a simple program<\/li>\n  <li>Make the LED turn ON and OFF repeatedly<\/li>\n<\/ul>\n\n<hr \/>\n\n<h2 style=\"font-size: 24px; font-weight: 600;\">Components Used<\/h2>\n\n<ul>\n  <li>ESP32-S3 board<\/li>\n  <li>USB cable (for power and programming)<\/li>\n  <li>LED<\/li>\n  <li>Resistor<\/li>\n  <li>Breadboard or extension board<\/li>\n  <li>Jumper wires<\/li>\n<\/ul>\n\n<hr \/>\n\n<h2 style=\"font-size: 24px; font-weight: 600;\">Understanding the Circuit<\/h2>\n\n<p>To light an LED, you need a complete electrical loop:<\/p>\n\n<pre id=\"loop1\" style=\"background:#f6f8fa; padding:14px; border-radius:8px; overflow-x:auto;\"><code>GPIO \u2192 LED \u2192 Resistor \u2192 GND<\/code><\/pre>\n\n<ul>\n  <li>GPIO provides controlled power<\/li>\n  <li>The LED emits light when current flows<\/li>\n  <li>The resistor limits current to prevent damage<\/li>\n  <li>GND completes the circuit<\/li>\n<\/ul>\n\n<hr \/>\n\n<h2 style=\"font-size: 24px; font-weight: 600;\">The Code<\/h2>\n\n<p>Here is the MicroPython code used:<\/p>\n\n<pre style=\"background:#f6f8fa; padding:14px; border-radius:8px; overflow-x:auto;\"><code class=\"language-python\" id=\"code1\">from machine import Pin\nimport time\n\nled = Pin(4, Pin.OUT)\n\nwhile True:\n    led.value(1)\n    time.sleep(0.5)\n    led.value(0)\n    time.sleep(0.5)<\/code><\/pre>\n\n<p>\nThis program continuously turns the LED ON and OFF every half second.\n<\/p>\n\n<hr \/>\n\n<h2 style=\"font-size: 24px; font-weight: 600;\">Challenges Faced<\/h2>\n\n<h3 style=\"font-size: 19px; font-weight: 600;\">1. Running Code in the Wrong Environment<\/h3>\n\n<p>\nInitially, I tried running the code using standard Python on my computer, which resulted in:\n<\/p>\n\n<pre style=\"background:#f6f8fa; padding:14px; border-radius:8px; overflow-x:auto;\"><code id=\"err1\">ModuleNotFoundError: No module named 'machine'<\/code><\/pre>\n\n<p>\nThis happened because MicroPython code must run on the ESP32, not on a regular Python interpreter.\n<\/p>\n\n<h3 style=\"font-size: 19px; font-weight: 600;\">2. Confusion Between Arduino and MicroPython<\/h3>\n\n<p>\nI switched between Arduino IDE and Thonny, which caused confusion. Each uses a different programming language and workflow.\nChoosing one environment and sticking with it resolved this issue.\n<\/p>\n\n<h3 style=\"font-size: 19px; font-weight: 600;\">3. Breadboard Misunderstanding<\/h3>\n\n<p>\nAt first, I did not understand how breadboard connections work. The key realization was:\n<\/p>\n\n<ul>\n  <li>Rows are connected horizontally<\/li>\n  <li>The center gap separates the two sides<\/li>\n<\/ul>\n\n<p>\nMy initial wiring did not form a complete circuit.\n<\/p>\n\n<h3 style=\"font-size: 19px; font-weight: 600;\">4. Unstable Connections<\/h3>\n\n<p>\nAt one point, the LED only turned on when I manually touched wires together.\nThis indicated that the circuit worked, but the connections were not properly secured.\n<\/p>\n\n<h3 style=\"font-size: 19px; font-weight: 600;\">5. Invalid GPIO Pins<\/h3>\n\n<p>\nUsing certain pins resulted in errors such as:\n<\/p>\n\n<pre style=\"background:#f6f8fa; padding:14px; border-radius:8px; overflow-x:auto;\"><code id=\"err2\">ValueError: invalid pin<\/code><\/pre>\n\n<p>\nThis showed that not all GPIO pins are available or usable on every ESP32 board.\n<\/p>\n\n<h3 style=\"font-size: 19px; font-weight: 600;\">6. Physical Layout Constraints<\/h3>\n\n<p>\nThe ESP32 board covered many breadboard rows, limiting access to certain pins.\nI had to adjust my wiring and choose accessible GPIO pins.\n<\/p>\n\n<hr \/>\n\n<h2 style=\"font-size: 24px; font-weight: 600;\">The Breakthrough<\/h2>\n\n<p>The project worked when I:<\/p>\n\n<ul>\n  <li>Used a valid GPIO pin<\/li>\n  <li>Connected the LED correctly:\n    <ul>\n      <li>Long leg to GPIO<\/li>\n      <li>Short leg to resistor and GND<\/li>\n    <\/ul>\n  <\/li>\n  <li>Ensured all connections were firm and properly placed<\/li>\n<\/ul>\n\n<p>\nThe LED finally blinked as expected.\n<\/p>\n\n<hr \/>\n\n<h2 style=\"font-size: 24px; font-weight: 600;\">Key Learnings<\/h2>\n\n<p>This project helped me understand:<\/p>\n\n<ul>\n  <li>How GPIO pins control hardware<\/li>\n  <li>The importance of GND in completing a circuit<\/li>\n  <li>How current flows in a loop<\/li>\n  <li>Why resistors are necessary<\/li>\n  <li>The need for alignment between software and hardware<\/li>\n<\/ul>\n\n<hr \/>\n\n<h2 style=\"font-size: 24px; font-weight: 600;\">Conclusion<\/h2>\n\n<p>\nAlthough simple, this project provided a strong foundation in embedded systems.\nIt highlighted the importance of careful wiring, correct configuration, and systematic debugging.\n<\/p>\n\n<hr \/>\n\n<h2 style=\"font-size: 24px; font-weight: 600;\">Next Steps<\/h2>\n\n<ul>\n  <li>Control the LED using a button<\/li>\n  <li>Read input from sensors<\/li>\n  <li>Connect the ESP32 to WiFi<\/li>\n<\/ul>\n\n<hr \/>\n\n<h2 style=\"font-size: 24px; font-weight: 600;\">Advice for Beginners<\/h2>\n\n<ul>\n  <li>Focus on one tool at a time<\/li>\n  <li>Test small parts of the system incrementally<\/li>\n  <li>Expect errors and use them as learning opportunities<\/li>\n  <li>Pay close attention to wiring and connections<\/li>\n<\/ul>\n\n<hr \/>\n\n<p>\nThis project marks the beginning of my journey into embedded systems and robotics.\n<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-0516bb7 e-flex e-con-boxed e-con e-parent\" data-id=\"0516bb7\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Introduction I recently started learning embedded systems and robotics using an ESP32-S3 starter kit. My first project was to make an LED blink. Although it sounds simple, it turned out to be a valuable introduction to how hardware and software interact. The Goal The objective of this project was: Connect an LED to the ESP32 [&hellip;]<\/p>","protected":false},"author":1,"featured_media":7845,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"postBodyCss":"","postBodyMargin":[],"postBodyPadding":[],"postBodyBackground":{"backgroundType":"classic","gradient":""},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7844","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/posts\/7844","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/comments?post=7844"}],"version-history":[{"count":7,"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/posts\/7844\/revisions"}],"predecessor-version":[{"id":7853,"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/posts\/7844\/revisions\/7853"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/media\/7845"}],"wp:attachment":[{"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/media?parent=7844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/categories?post=7844"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hishamghanayem.com\/en\/wp-json\/wp\/v2\/tags?post=7844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}