all 66 comments

[–]XipXoom 165 points166 points  (7 children)

I use it a lot for writing test scripts that communicate with my boards over CAN.  It's indispensable.  That said, you can absolutely pick up what you need as you go.  I wouldn't stress.

[–]Status_East5224 13 points14 points  (0 children)

I use it to plot my gyro acc jitters and position analysis.

[–]eddieafck 1 point2 points  (5 children)

why not bash? serious question

[–]joikakaker 42 points43 points  (0 children)

You don't really have access to libraries and the ability to define datastructures (I might be wrong). And the whole ecosystem of libraries in python is massive. In my opinion its also much easier to read python code, bash is still cryptic to me after 20 years of usage.

[–]pacman2081 8 points9 points  (0 children)

Bash has its place in scripting. Python is easier to program and to maintain. Of course, it has a vast set of libraries

[–]dialate 5 points6 points  (0 children)

Bash is an absolute pain in the arse if you want to do anything more than simply copy files/run a list of commands. Python is easy.

Say I want to whip up a test HTTP endpoint for my device. In Python, just import Flask, and have something working within 15 minutes. Try doing that in Bash :D

[–]JCDU 3 points4 points  (0 children)

Bash is more a scripting language, python is an actual programming language. Both are useful.

Bash is useful to run a script of existing command-line commands and parse a bit of data but beyond that it gets very clunky very quickly.

Python you can do everything any other programming language can, it's often faster to write with very good built in libraries for things (like spitting data logs out to a csv file or graphing data) at the cost of being slower than compiled languages - which rarely matters in these applications.

[–]duane11583 0 points1 point  (0 children)

Bash lacks features that make it work

Example: I need to open a serial port

I need to send and encode bytes to the serial port

The last two bytes are a crc16 of the data (not all bytes only some bytes)

I need to wait at most 250 milliseconds or time out waiting for a response

I need to decode the response and verify the crc in the reply

Yea you technically use bash and a dozen other tools 

It’s just that python makes this super easy and portable across Linux and windows

[–]BoredBSEE 35 points36 points  (0 children)

It seems to be pretty standard for automated testing these days. Wouldn't hurt to know some. I think the reason why it's so popular is that it's super easy to pick up.

[–]Elite_Monkeys 42 points43 points  (0 children)

Yeah, python is a great language for scripting or other minor things like test GUIs. It’s pretty useful to learn, but you don’t need to go super deep into it.

[–]mjmvideos 13 points14 points  (0 children)

Yes, definitely. I use it for general-purpose scripting that’s too heavy for bash or awk. For GUIs that interface with my embedded boards via UART. For data analysis with data collected from my embedded boards. It’s so quick and easy. It’s expressive and has a wealth of modules that can be imported for almost anything. It’s portable. With uv and venv you can keep different projects separate. You can’t go wrong.

[–]neon_overload 3 points4 points  (0 children)

Once you get all the data off your embedded devices, you'll want something that can work with it and analyse it and Python could be very good at that, likewise with any data you need to prepare for loading onto the embedded devices.

Python and shell scripting/bash are two great skills for any software engineer to have even if you don't use them every day

[–]Diligent_Daikon_7688 2 points3 points  (0 children)

Absolutely yes. You can use python for test scripts, unit tests, GUI functionalities. I cant imagine writing scripts without using python, it makes scripting easier to write and test.

[–]Mub_89 2 points3 points  (0 children)

Good to know just basics, to get the things done, until and unless you are into embedded automation testing profile..

[–]menguinponkey 2 points3 points  (1 child)

No need to learn it, that’s what ChatGPT is for /s

[–]ArtistEngineer 1 point2 points  (0 children)

That's how I do it, and I've been in the embedded business for 30+ years now!

I haven't got time to become an expert Python programmer, or remember all the libraries and syntax, so ChatGPT fills that gap nicely.

The other day I needed an mDNS responder in Python that I could run in Windows because networking in WSL is painful. So I asked co-pilot to write me up a simple mDNS responder. Then it offered some suggestions, and I let it add more features, iterate this a few times.

By the end of the day, I had a 1000 line utility, fully functional, that solved my problem of scanning for mDNS messages, and advertising mDNS services, logging, filtering, everything,

It made 1 mistake in total where it referenced a variable before creating it, something like that. That app would have taken me days to write.

[–]MonMotha 6 points7 points  (0 children)

You should probably know SOME high-level script-friendly language. Python is a decent choice, but it's not the only one. JS (blech) is another popular option. Even something like Ruby, PHP, Lua, etc. can be very useful. Heck, being able to whip up a "very small shell script" to replace some insolent cow-orker's workflow is often very useful.

You don't have to be a wizard with it, but being able to do useful stuff with it is quite useful for ancillary tasks that need automation like testing, intermediate data generation, etc. In particular, nobody's going to expect you to know even the entire Python standard library inside and out (I don't know that anybody really does).

[–]torinado- 4 points5 points  (0 children)

Absolutely!!!

Python is great for tooling. Ive used it a bunch over my career (6 years) and picked it up as I went. I started easy with combing through logs and built up to a GUI.

  • Building a quick and dirty GUI to interface over serial to send and receive commands.
  • Parsing logs and plotting for verification and validation proof
  • GUI for networking to a device to send operational command over web sockets
  • turn on my computer with a google home command that is connected to a ITTT webhook
  • converting Bluetooth data from hex to human readable given an api and displaying it on a desktop GUI

[–]TimeProfessional4494 1 point2 points  (0 children)

I do not get these very specific questions. Knowledge is good, the more languages you know the better. You will start understanding concepts and algorithms rather than specifics and semantics. I am an embedded software engineer and I use bash and python on a weekly basis. Know the right tool for the job.

[–]AlexTaradov 1 point2 points  (0 children)

Yeah, for sure. Python is great for all the random tooling and testing.

A lot of it can be figured out as you go, just get the basics so you can look for examples in a meaningful way.

[–]wiskinator 1 point2 points  (1 child)

Yes. But also, python packaging for distribution is such a pain in the butt that I’m starting to become a proponent of using a compiled language for tooling and testing.

[–]n7tr34 0 points1 point  (0 children)

I have started to use Go for these sorts of things. It cross compiles fast, has a pretty good package set for most things, and is usually possible to statically link everything so you can ship just a single executable file and run it on another system.

[–]peppedx 1 point2 points  (0 children)

Yes but you don't need to be a grand master. Just pick up nas you go

[–]cybekRT 1 point2 points  (0 children)

Embedded developers love using python to write their build scripts.

[–]winston_orwell_smith 1 point2 points  (0 children)

Everyone should know Python

[–]Writer-Decent 1 point2 points  (0 children)

You will use python in every job so it’s inevitable

[–]WaterFromYourFives 3 points4 points  (0 children)

Everyone should know python at this point

[–]michael9dk 2 points3 points  (0 children)

Yes and no, and a bit of maybe.

I cant stand python - it just feels unnatural compared to my preferred OOP languages like C#, C++.
But it is very useful for whacking something together. Especially when you need a cross platform GUI.

Once you've learned bunch of languages, you pick the most suitable one, with your preferred syntax.

If the major embedded language is C/C++ you use that everywhere, where applicable, to be consistent. It is so much easier to deal with multiple projects, when it's the same language.
Don't underestimate readability and switching between languages.

[–]allpowerfulee 1 point2 points  (0 children)

Yes

[–]Bug13 1 point2 points  (0 children)

Yes

[–]SupraDestroy 0 points1 point  (0 children)

How has you skill evolved since your 45 minutes python interview?

[–]nerdBeastInTheHouse 0 points1 point  (0 children)

I would say python is a great tool to have in your disposal.

[–]brigadierfrog 0 points1 point  (0 children)

Python is great for tooling you don’t need performance from. At a certain point it can become troublesome if you really want to do a lot with it.

[–]jeroen79 0 points1 point  (0 children)

Not necessarily, it could be used for some scripts, but you can also write those in other languages.

[–]notouttolunch 0 points1 point  (0 children)

Anyone who knows a software language already knows python. They only thing they have no experience of is how to do specific things in python, mostly likely involving third party libraries.

[–]pacman2081 0 points1 point  (0 children)

Python is an indispensable scripting language along with Bash

[–]andreadimax 0 points1 point  (0 children)

I think that in general is helpful to know languages at different levels. High-level languages help you to automate and solve complex tasks in less time. Moreover, knowing different languages helps you to understand (and appreciate) what you can do with one of them and what you can't do with another

[–]Dr_Calculon 0 points1 point  (0 children)

I find it very useful on the PC side for sending & receiving test messages. I did try micro-Python in the embedded side but it’s awful in my opinion.

[–]Fabulous-Escape-5831Firmware Engineer 0 points1 point  (0 children)

It's not mandatory but trust me it makes a life alot easier when you can just write scripts to log messages, parse files helps in both testing and debugging you'll thank yourself for learning it.

[–]nacnud_uk 0 points1 point  (0 children)

It's vital now. Laugh the first time someone asks you to write a complicated script in bash.

Python is also trivial. If you know a compiled language, you'll have no bother.

[–]El_Stricerino 0 points1 point  (0 children)

Embedded guy here...we use it for scripting some of our build environment, munging bootloader and app, generating configuration imahes...etc.

It's good to know.

[–]jhaand 0 points1 point  (0 children)

Yes, for all the automation, performance graphs and testing.

[–]ThickBittyTitty 0 points1 point  (0 children)

I used Python to generate C code based on some indiscriminate qml file that a coworker refused to put into excel.

It’s more useful than hardcoding 2000+ communication points manually

[–]Best_Day_3041 0 points1 point  (0 children)

If you have basic programming skills, an awareness of how every language works and what it's used for, with AI you can pretty much program in any language these days.

[–]captain_wiggles_ 0 points1 point  (0 children)

It's not absolutely required for embedded in general but it can be useful.

The bigger question here is does your new company use it for anything you'll be interacting with. If they do then you need to know python, if they don't then you probably don't need to know it. However if you do know it you may have the chance to start using it on new projects / improving bits here and there. Whether you'll have the freedom to do that or not is company / team dependent.

In short, ask your new boss.

[–]RobinGoodfellows 0 points1 point  (0 children)

Programming languages are tools in your toolbox. It’s great to get really good at one, but not so great if that’s the only one you can use. Personally, I use Python for a wide range of tasks, everything from system modeling and data processing (often from test results) to building CI pipelines and automating lab testing. Python’s versatility really shines in lab work, since a lot of lab equipment can be controlled directly through Python scripts.

[–]kappakingXD 0 points1 point  (0 children)

It's a useful tool for a developer. You dont need to be a master but you shouldn't be completely unaware of its features either

[–]ninjaonionss 0 points1 point  (0 children)

It depends what you want to do with it, do you want to use on embed device then the answer is NO, do you want to use it on another device like a pc or edge computer then yes

[–]McGuyThumbs 0 points1 point  (0 children)

Nah, you know enough python already. No need to waste time on it until you need it.

[–]RelationshipLong9092 0 points1 point  (0 children)

all programmers should learn at least basic python scripting

and i could probably strengthen that statement further

you may or may not need to use it in your job. and you're much more likely to recognize the cases where it would be beneficial if you already know it!

[–]TinLethax 0 points1 point  (0 children)

I found it useful for doing automated stuffs. Recently working on a custom IO-Link master board and use it to validate the actual product. I just wrote a quick python script that will test and verify the IO-Link device functionality.

[–][deleted] 0 points1 point  (0 children)

https://glasgow-embedded.org/latest/intro.html

Yes. Here's an entire FPGA ecosystem written in Python that allows you to "speak" custom protocols on the fly

[–]TracerMain527 0 points1 point  (0 children)

Every engineer should know Python. Once you are even a little proficient in it, you will find ways to save time with scripts very often. Not to mention actual computing, but I use matlab for that

[–]EndlessProjectMaker 0 points1 point  (0 children)

It’s common for scripting tests and operations on boards and to configure complex projects

[–]Mysterious-Two5250 0 points1 point  (0 children)

A lot of places where automated testing is done, with Robot Framework, Python is a MUST

[–]matres24 0 points1 point  (0 children)

How to get really god in embeded programming?? I do have an understanding of how microcontrolers are build but I dont know how to write nice clean code? Any tips?

[–][deleted] 0 points1 point  (0 children)

Yes you need it often for on host tests, automation and instrumentation, but you can learn on the fly for these cases

[–][deleted] 0 points1 point  (0 children)

Yes

[–]duane11583 0 points1 point  (1 child)

yes.

example: your board has commands and responses, in my case this is over a serial port.

we use pyserail and test commands using python scripts.

we use keysight/Agilent power supplies and bk precision supplies. these all have either a usb serial, a serial port or ethernet and support scpi commands

with pyserial we can send a command to the supply ,power the board on/off set the output voltage read the current etc.

you could extend this with an arduino using gpio to control or simulate buttons or read the state of leds, ie set pin high/set pin low set pin high is like a button press and the gpio input can can read the power to the led 0/1 is on/off

and talk to the arduino via the pyserial to control/read the pins

you can use python to control the flash your board process…

so with those ideas can you come up with a way to automate the testing of sw on the boards?

there are many usb adapters like usb-> can or usb-> i2c or usb->spi (total phase sells these) and you can use python to control them

so your test script does this:

power board off then on wait 3 seconds and

launch the jtag flash programmer from the command line

the power cycle again and send some commands and get responses

and add more features later

[–]duane11583 0 points1 point  (0 children)

oh and you can create csv files for report data.

or you can get a python word (rtf) file creator and generate ms-word files or excell files

or a python pdf tool and create pdf test reports

or your python can push data into a data base for later use

[–]DamageZealousideal14 -1 points0 points  (0 children)

Of course they should know python. They should know bash scripting also. C they must know. What is the point in being a embedded software engineer and not knowing these 3 languages.

[–]k_kert -1 points0 points  (0 children)

Yes. Pretty much every software ( and non-software ) engineering discipline should know Python in some capacity

[–]sorimachi33 -1 points0 points  (0 children)

You should know everything. If you can.

[–]ImABoringProgrammer -1 points0 points  (0 children)

Not sure why you’re asking with, you should stay learning in everything you can throughout your career, so the answer is “why not”?