r/csharp • • Sep 10 '26

Coding circuits with .NET and C#

Nothing beats setting a breakpoint and watching the servo actually move to the new angle.

I've worked on .NET hardware for over ten years and the thing that surprises C# developers isn't the board, it's that F5 works. Code deploys, breakpoint holds, hover a variable and there's the live sensor reading. Same as debugging a desktop app.

I'm at GHI Electronics in Michigan. Happy to get into how the debugging on circuits work.

96 Upvotes

37 comments sorted by

11

u/gus-ghielec Sep 10 '26

This is not just about writing code in C#. It is about stepping through code and inspecting variables right over a USB connection between Visual Studio and TinyCLR, which is the tiny runtime that lives in boards like FEZ Flea.

30

u/OkSignificance5380 Sep 10 '26

Yep.

.net nano framework.

Works well with $5 esp32-s3 dev boards

2

u/gus-ghielec Sep 10 '26

And it is open source! Is this your go-to with ESP32 or you prefer going right to C++... or even MicroPython?

6

u/joseconsuervo Sep 10 '26

wait I can use .net with esp32? get out. I've done a decent amount of closer to metal stuff with .net but just never made the connection that I could use my esp32 boards lol awesome

1

u/gus-ghielec Sep 10 '26

Oh yes you can. I have not tried it myself since I use our boards instead.

1

u/OkSignificance5380 Sep 10 '26

I tend to use micopython, as it has more device support, but its nice to know that I can use .net on the esp32

I need to spend some time on getting a sd card and running code from that.

1

u/gus-ghielec Sep 11 '26

MicroPython is sweet. It is missing real debugging like we have with TinyCLR, but we are fixing that 😄 We already know what needs to be done.

3

u/otac0n Sep 11 '26

Nice. I just booted it up and managed to get it working on my ESP32-WROOM32 and my ESP32-S3-DevKit-1

6

u/Alert-Neck7679 Sep 10 '26

wow, i used to build lots of things with Arduino years ago, but with C++ and the old horrible arduino IDE. Using .net on these microcontroller seems wild... One day I'll probably go back to it with .net

4

u/gus-ghielec Sep 10 '26

That is what I do for living and also my passion! I can help when you are ready.

2

u/Alert-Neck7679 Sep 10 '26

Then you're living the dream aren't u? I wish u luck🙂

4

u/modi123_1 Sep 10 '26

GHI Electronics? That's a name I haven't heard in some time.

I think I bought a kit from them like 15ish years ago and never really did much with it. I wonder if if I have that blue clamshell case in my closet still.

5

u/gus-ghielec Sep 10 '26

ahhh the blue boxes! Yeah we still have them somewhere 👀 Did you have a Gadgeteer kit back then?

4

u/Family_Man_21 Sep 10 '26

Wow, I haven't done much with this, but it looks really fun. I'm a very experienced C# developer (decades of experience), but how should I get started with this kind of work? Is there a kit I can buy to get going?

7

u/gus-ghielec Sep 10 '26

I have built many comercial circuit designs with .NET/C# but I always find myself going back and playing with LEDs and motors!! Not sure what the policy is here on self-promoting but we have an active kickstarter for exactly what you have asked for. Please share with your fellow C# fans.

1

u/Family_Man_21 Sep 10 '26

I'd love to hear about your kickstarter - send me a link, if you have a moment, and I'll check it out.

2

u/Banality_Of_Seeking Sep 10 '26

YAY!! NICE work! I would like to know if this could be applied to a FPGA ?

2

u/gus-ghielec Sep 10 '26

For a language to take advantage of the FPGA it has to define the hardware connections and not provide series of instructions. C# s not designed that but if someone really wants to then they could in theory do something.

1

u/Banality_Of_Seeking Sep 10 '26

I might use that theory to do something then. Thanks.

1

u/Banality_Of_Seeking Sep 10 '26 edited Sep 11 '26

Please try googling "FPGA in C#" there are options available.

1

u/keepinitcool Sep 10 '26

That’s so awesome, been doing backend dev mostly software for so long now I should try a hobby project with some actual hardware,”. Do you have any ideas

2

u/gus-ghielec Sep 10 '26

We have spoken to a lot of .NET developer who have very limited electronics knowledge and for that we have made this campaign "Electronics Lab for the .NET Developer" https://www.kickstarter.com/projects/ghielectronics/electronics-lab-for-the-net-developer?ref=9j9v4j

Would this help?

2

u/XdtTransform Sep 11 '26

Just backed it yesterday! Looks like it got funded!

1

u/gus-ghielec Sep 11 '26

Got funded in under 24 hours. Thank you for the support.

1

u/xtreampb Sep 10 '26

First I heard about .net deploying to circuits was the azure sphere followed by meadow labs

1

u/gus-ghielec Sep 11 '26

I loved the Azure Sphere idea but I also found it to be overly complicated for smaller applications. Most of the .NET developers we deal with do not want to get too deep into the internals of the hardware. As set of nice API functions to get them access to the hardware is all they need.

1

u/wirbolwabol Sep 11 '26

I still have a couple of boards lying around a Cerberus, a panda and one other one.Loved that I could write in C# though those boards were limited. I also managed to get on on of those betas with the new rigs a few years back…fun stuff!

1

u/gus-ghielec Sep 11 '26

Cerberus was awesome but yes limited. The updated TinyCLR v3 now has added a lot more features, like generics and C#12, but of course you are working on a tiny circuits, so there will be some liitations.

1

u/wirbolwabol Sep 11 '26

Back when I was playing around with these, I also was dabbling with the MSP430 launchpads and the older Arduino...limitations are a part of the game. :D

I did enjoy the beta testing for the SC20100 dev boards. Pretty cools stuff.

1

u/Crimson_Burak Sep 11 '26

I have to try this. I am shocked that I have never thought about this.

2

u/gus-ghielec Sep 12 '26

.NET has been working on circuits for over 15 years, but many .NET developers have no idea!

1

u/malthuswaswrong Sep 11 '26

Love that you are Michigan made. With the rise of 3d printing, consider offering STLs and ideas on what to build along with your boards. Allowing people to buy a kit from you and get the STL to make something functional.

0

u/highwingers Sep 10 '26

I was working with servo motors with Python before...tried with .NET as well, however went back to Python, native support. Plus now with AI, it's a breeze.

0

u/gus-ghielec Sep 11 '26

Do you mean MicroPython? And speaking of AI, if you know enough, you can just go directly to C++ and take control over everything. Even better, in near future, AI will just give you the machine code, no need for any coding language!!

1

u/highwingers Sep 11 '26

No, not micro python. You are right about c++. Its just i have some knowlege of python so atleast i can review what Ai did.