←Index



09/27 Embedded Coding ## Week 2: In this week, we learned different micro-processors and how their performance vary depending on processor architecture and coding language. # Recitation [slides](https://docs.google.com/presentation/d/1QBAj1QgFCpSJy49w0o6DBQhh0tz-S2o5GQJGR04k3fk/edit#slide=id.g280307503e6_0_0) - HuggingGPT, LangChain[LangChain](https://www.langchain.com), Anthropic[Antropic](https://www.anthropic.com) larger context "memory", more responsible with data, **CAD** using ChatGPT with DSL, [OpenJSCAD](https://openjscad.azurewebsites.net), [PyVista](https://docs.pyvista.org/version/stable/) experiment to find out a good way to combine ChatGPT and CAD - 3D object [Threestudio](https://github.com/threestudio-project/threestudio), DALLE, Stable Diffusion, Midjourney, [Valdemart](https://github.com/valleballe/depthfusion/) - Electronics Week: [Chat pdf](https://www.chatpdf.com) - [Olivia Seow](https://www.oliviaseow.com), conversational agent - Cool ideas for [htmaa](https://www.haystack-mtn.org/haystack-labs) # Class notes - You can setup git short cuts [aliasses](http://academy.cba.mit.edu/classes/project_management/archive.html) - `ls -sh` shows the sizes from terminal, **geeqie** image viewer. - Generate 1 - 10mb a week is a resonable pace. Video goes few mb/minute [guideline to compress video](http://academy.cba.mit.edu/classes/computer_design/video.html) - Don't use GIF, MP4 can loop and has a better compression. - When you get a Git message you don't understand e.g. rebase, try to clone again and push into that version. [dangit](https://dangitgit.com) can be helpful. - Deadbug electronics, develop circuts in 3D [zach fredin](https://zachfred.in), [Taktstudio](https://www.taktproject.com/collaborate) - Almost anything reacts to almost anything, Electric magnetic tags that sense materials, Richard Fletcher - Slicer with Fusion360 # Embedded programming Xiao Seeed Studio We will use RISC Harvard architecture microcontroller. There are multiple Memories e.g. EEPROM: programme and remember it, even when power is off. Depending on the processor and the language the processing speed is differnt. [pi benchmark](https://gitlab.cba.mit.edu/pub/pi). Low level commands is 10x faster than using a high level language. This correlates to how smooth audio is played, how responsive the interactive object is. 1. First pick a processor; SAMD21 or ESP32-C3. 2. Choose your language: Assembly -> Mnemonics -> C/C++ -> MicroPython -> Espruino (embedded processor js) 3. REPL and python to load the code to the processor. 4. Write the code in a develop environment e.g. VScode. 5. Don't start from scratch. Always modify something that works. --- # Assignments - Group Assignment: Compare the performance of processors. - Read datasheet of the microcontroller - sam-d11-c [datasheet](https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-42363-SAM-D11_Summary.pdf) - XIAO RP2030 [datasheet](https://files.seeedstudio.com/wiki/XIAO-RP2040/res/rp2040_datasheet.pdf) - XIAO ESP32-C3 [datasheet](https://files.seeedstudio.com/wiki/Seeed-Studio-XIAO-ESP32/esp32-c3_datasheet.pdf) - write a program for microcontroller [xiao](https://www.seeedstudio.com/blog/2020/04/23 use-seeeduino-xiao-in-kicad-pcb-design-like-a-components/) - local interaction with input (e.g. touch, pin) and output - interact wireless remotely ## Idea - make the processor generate geometric images - use natural material to make electronics - Make 2 Fans talking to each other ## 1) interact locally with input First I tried to make [XIAO-RP2040](https://wiki.seeedstudio.com/XIAO-RP2040/) blink with C code through the Arduino Environment. I faced the problem that Arudino IDE does not recognize the port. I changed the dongle and it worked. Secondly, I used [MicroPython](https://wiki.seeedstudio.com/XIAO-RP2040-with-MicroPython/) to make the RP2040 blink. ## 2) interact wirelessly I was interested to make two [XIAO ESP32-C3](https://wiki.seeedstudio.com/XIAO_ESP32C3_WiFi_Usage/) communicate with one and another. I used one ESP32-C3 as a 'server' and the other one as the 'client' via TCP protocal. The 'server' listens to commands from 'client'. In my case, when the 'client' button is pressed, the 'server' diode blinks. ChatGPT and this [tutorial](https://esp32io.com/tutorials/communication-between-two-esp32) was a great coding help. One idea I was interested in is to link up two fans. When one person turns the fan by hand, the other fan would turn at the same speed. The idea is then to put one fan outdoor and let the wind turn the fan. In this way, the outside wind is transported into an indoor room through the 2nd fan. --- # Resources - files - [RP2040 blink Python](../week-2/files/beautiful_color.py) - [RP2040 blink Arduino](../week-2/files/RP2040-blink.ino) - [Wifi button code](../week-2/files/ESP32-wifi.ino) Working Mac - If possible don't use a dongle, or a simple one to connect to the computer. ESP32-C3 Wifi - I used my phone's hotspot to connect the ESPs, because I could not find a solution to connect to Wifi with a captive portal. On Soldering - Do solder pcb sockets to components when using a breadboard! Don't just stick it. Soldering makes results much more reliable. - Use ample of solder lead. Where to buy components - [Octopart](https://octopart.com) - [Digikey](https://www.espruino.com) - SEEED tutorial with Arduino and MicroPython[source](https://wiki.seeedstudio.com/XIAO-RP2040-with-MicroPython/) [OnlyFans](https://onlyfans.web.cern.ch) --- ↳About