<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>firebeetle Archives - Creatronix</title>
	<atom:link href="https://creatronix.de/tag/firebeetle/feed/" rel="self" type="application/rss+xml" />
	<link>https://creatronix.de/tag/firebeetle/</link>
	<description>My adventures in code &#38; business</description>
	<lastBuildDate>Thu, 09 Oct 2025 14:39:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Using MicroPython on FireBeetle ESP32</title>
		<link>https://creatronix.de/using-micropython-on-firebeetle-esp32/</link>
		
		<dc:creator><![CDATA[Jörn]]></dc:creator>
		<pubDate>Sat, 04 Apr 2020 14:16:24 +0000</pubDate>
				<category><![CDATA[Electronics & IOT]]></category>
		<category><![CDATA[ampy]]></category>
		<category><![CDATA[blink]]></category>
		<category><![CDATA[esp32]]></category>
		<category><![CDATA[esptool]]></category>
		<category><![CDATA[firebeetle]]></category>
		<category><![CDATA[micropython]]></category>
		<guid isPermaLink="false">http://creatronix.de/?p=3175</guid>

					<description><![CDATA[<p>Motivation In Fire Beetle ESP 32 Project I wrote about connecting the FireBeetle ESP32 with the Arduino IDE and writing a little C-style program. Another interesting approach is to use MicroPython. Installing MicroPython Install esptool To get MicroPython onto the board we use the esptool command line. Because we are in the Python ecosystem we&#8230;</p>
<p>The post <a href="https://creatronix.de/using-micropython-on-firebeetle-esp32/">Using MicroPython on FireBeetle ESP32</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Motivation</h2>
<p>In <a href="https://creatronix.de/install-esp32-in-arduinoide/">Fire Beetle ESP 32 Project</a> I wrote about connecting the FireBeetle ESP32 with the Arduino IDE and writing a little C-style program. Another interesting approach is to use MicroPython.</p>
<h2>Installing MicroPython</h2>
<h3>Install esptool</h3>
<p>To get MicroPython onto the board we use the esptool command line. Because we are in the Python ecosystem we use pip to install esptool:</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-bash" data-lang="Bash"><code>pip install esptool</code></pre>
</div>
<h3>Download firmware</h3>
<p>Go to https://micropython.org/download/esp32/</p>
<p>and download the latest release as of today is <strong>v1.19.1 (2022-06-18) .bin</strong></p>
<h3>Erase flash</h3>
<p>Before we can install the firmware it is recommended to erase the flash</p>
<p>On my machine the port is /dev/tty.usbserial-14130. This can vary depending on your OS and setup.</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-bash" data-lang="Bash"><code>esptool.py --port /dev/tty.usbserial-14130 erase_flash</code></pre>
</div>
<h3>Flash Firmware</h3>
<p>Flashing the firmware looks like the following:</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-bash" data-lang="Bash"><code>esptool.py --chip esp32 --baud 115200 --port /dev/tty.usbserial-14130 write_flash -z 0x1000 ./esp32-idf3-20191220-v1.12.bin</code></pre>
</div>
<p>To prevent flash errors we set the transmission speed to 115200 baud</p>
<h2>Connect via Serial</h2>
<p>When you work with an unixoid system like linux or macos you can use screen to connect via serial port. On Windows you can download the program putty</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-bash" data-lang="Bash"><code>screen /dev/tty.usbserial-14130 115200</code></pre>
</div>
<p>After connecting you will get the prompt from the python command line aka REPL</p>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-3181" src="https://creatronix.de/wp-content/uploads/2020/04/conect_via_screen.png" alt="" width="868" height="157" srcset="https://creatronix.de/wp-content/uploads/2020/04/conect_via_screen.png 868w, https://creatronix.de/wp-content/uploads/2020/04/conect_via_screen-300x54.png 300w, https://creatronix.de/wp-content/uploads/2020/04/conect_via_screen-768x139.png 768w" sizes="(max-width: 868px) 100vw, 868px" /></p>
<h2>Working with scripts</h2>
<p>After fiddling around with the REPL we want to write our first program. We write a program like the Arduino blink sketch but just in Python:</p>
<h3>Blink Program</h3>
<p>The onboard blue led is connected to pin 2</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code>from machine import Pin 
import time 
p2 = Pin(2, Pin.OUT) 
def blink(): 
    while True: 
        p2.value(0) 
        time.sleep(1) 
        p2.value(1) 
        time.sleep(1) 
blink()</code></pre>
</div>
<h3>Save this script in a file with the name blink.py</h3>
<h3>Uploading scripts</h3>
<p>To upload scripts to the FireBeetle board we use another nice library called ampy from AdaFruit. We install it via pip as well</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-bash" data-lang="Bash"><code>pip install adafruit-ampy</code></pre>
</div>
<p>With ampy we can upload the file to our board.</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-bash" data-lang="Bash"><code>ampy --port /dev/tty.usbserial-14130 put blink.py</code></pre>
</div>
<p>If it doesn&#8217;t work right away, please close your terminal connection.</p>
<h3>Starting scripts</h3>
<p>When the upload is finished you can reconnect via serial console and import your script and the led should start to blink</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-bash" data-lang="Bash"><code>&gt;&gt;&gt;import blink</code></pre>
</div>
<h3>Running scripts on startup</h3>
<p>When your script should start directly at power on, you upload it as main.py</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-bash" data-lang="Bash"><code>ampy --port /dev/tty.usbserial-14130 put blink.py /main.py</code></pre>
</div>
<p>If you had fun so far feel free to read my <a href="https://creatronix.de/firebeetle-project/">Mailbox IoT ESP 32 Project</a> article as well</p>
<h3>Further Reading</h3>
<p><a href="https://docs.micropython.org/en/latest/esp32/quickref.html#">https://docs.micropython.org/en/latest/esp32/quickref.html#</a></p>
<p><a href="https://blog.miguelgrinberg.com/post/micropython-and-the-internet-of-things-part-i-welcome">https://blog.miguelgrinberg.com/post/micropython-and-the-internet-of-things-part-i-welcome</a></p>
<p>The post <a href="https://creatronix.de/using-micropython-on-firebeetle-esp32/">Using MicroPython on FireBeetle ESP32</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
