Hi everyone,

I would like to learn to program and built project using MicroControllers

I’m a Python dev. Therefore I would like to use it to program those.

But I’ve no idea where to start…

  • For the hardware:
    • What will be the best Raspberry Pi or Arduino ?
      I know they are not the same thing but could tell me in which situation you use more one than the other ? Or do you use something else ?
  • Software
    • I’ve already my IDE VisualCodium
      What is MicroPython Vs CircuitPython ?

If you have any resources I’m all eras.

Thanks.

  • fubarx@lemmy.ml
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    3 months ago
    • Raspberry Pi runs general-purpose Linux-based operating systems. Most also come with python and provide libraries so you can access the peripherals and pinouts. It also supports other linux services like windowing, processes, etc. It’s useful if you have to control a lot of peripherals at once, for example, in a 3D printer, or a robot.

    • Arduino is designed for much smaller processors, typically with limited RAM and no protected memory. So you just run a single program each time it boots up, usually in a big loop that looks for changes in state (for example, a button press) and reacts (turns on a motor or light). OK for a lot of projects, but it slows down once you add too many devices.

    • There’s also an intermediate system called FreeRTOS that lets you run multiple ‘tasks’ at once, so you can squeeze more juice out of a simple microcontroller. Arduino and FreeRTOS are usually programmed in C/C++.

    • Micropython is a smaller version of python that runs on those small microcontrollers. It has the standard libraries to support IO pins, etc, but if you buy an add-on board, you’ll want to make sure it has the right drivers for it to work in Micropython.

    • CircuitPython is a slightly simpler version of Micropython, built and supported by Adafruit and last I checked, mainly used on boards made by them. They have lots of lessons and introductory material to get people started.

    If you want to start from scratch, recommend getting an ESP-32 based dev board from Adafruit or Sparkfun, then installing either of the Pythons on them.

    If you want to get into soldering, a plain no-name off AliExpress will also work. But Sparkfun has a small connector called Qwiic (Adafruit also has a similar one they call Stemma QT). Then get a few fun peripherals like a switch, a lamp, an environment sensor, and maybe a stepper motor with those connectors. They just plug into each other and you’re good to start coding.

    If you want it all in a compact package, including a screen, then check out M5Stack. They are the same inside, but in a more approachable package. They use a different wiring system called ‘grove’ so it’s easier to plug and play with their peripherals.

    If you want to get into home automation, check out HomeAssistant and their ESPHome project.

    The nice thing about using python is that there’s no separate compile-then-flash step. In most cases, you plug the board in, it appears as a drive, and you drag-drop your code file onto it. As your skills improve, you may find that your ideas may outgrow the tools. Feel free to jump up to Arduino, FreeRTOS, a linux, or an Android based system.

    It’s all good. Best of Luck!

  • nnullzz@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    3 months ago

    With a Raspberry Pi, you can use it as a microcontroller but also as a computer that can run an OS. So it’ll have things like networking, display outputs, but also have pins to connect devices to. You program a Pi with Python.

    An Arduino is more a microcontroller in the classical sense. It doesn’t run an OS, but rather the program you send to it, and that’s it. It’ll run that program forever. The programming language (or library as some refer to it) is more akin to C++.

    EDIT: I should note that an arduino can have peripherals and things like networking too, but you’ll need to buy “hats” as they’re called. They sit on top of the arduino, extending the pins but also giving you extra functionality.

    So I would say that if you’re explicitly trying to use Python, a Pi is the way to go. That said, there are toooons of guides out there with say “10 Raspberry Pi Projects for Beginners”. Sometimes Humble Bundle has bundles with those kinds of books.

    Get yourself a kit online with basic components if you don’t have them already. And maybe a breadboard. Just dive in. Don’t overthink the projects in the beginning. Just try the easy stuff till you understand enough that you can try making your own devices.

    • bjorney@lemmy.ca
      link
      fedilink
      English
      arrow-up
      2
      ·
      3 months ago

      So I would say that if you’re explicitly trying to use Python, a Pi is the way to go.

      I will point out you can run micropython on a lot of embedded boards now. I haven’t used it, so I don’t know if it’s actually good or if it’s more like those software-gore “here is my python package for building web front ends that is somehow worse than JS” packages you always see on python boards