Nucu Car: Devlog 0x02

Hello,

I’m still working on my NucuCar project from time to time, I’m currently at my parents home and I left the raspberry pi at my apartment so I’m only testing the builds it on my computer. Luckily I can test the telemetry by using the CPU temperature sensor implemented by dotnet IoT.

For the next step, I wanted an effective way to store telemetry data in the cloud, preferably for free, since this is a hobby project after all.

After testing multiple solutions I’ve settled with Firebase, I tried to write a telemetry publisher for it using it’s SDK which internally uses gRPC and everything went well until I put it on the board. It turns out that dotnet gRPC doesn’t work on raspberry pi. I got the basic server working using a hack but that’s about it, so I moved to the REST API and I’ve implemented a simple translator which translates raw C# dictionaries into compatible Firebase RESTful post request Json payload.

The project got a little bigger and at the current state it was quite messy, a restructuring is needed and this is what I’ve done:

NucuCar.Domain

Initially I’ve designed the NucuCar.Domain project to contain .proto files and data classes without too much implementation, however, many Telemetry Publishers such as Azure, Disk were in this package and it was kind of wrong because they contain too much implementation and they were dependent on heavy external packages and they would bring too much of a burden.

The TelemetryPublisher abstract class and the ITelemeter interface both which don’t contain implementation remained in NucuCar.Domain and the concrete publishers along with the worker were extracted in NucuCar.Telemetry.

I’ve also extracted the Firebase translator into a package of it’s own, and published it on NuGet, making this my first published package. 😀

NucuCar.Common

In NucuCar.Common, I’ve moved some of the classes which were utility classes and were still present in NucuCar.Domain, the ConnectionParser class and a class which provides basic argument guarding.

Another thing that I needed and I’ve implemented in NucuCar.Common is a HttpClient wrapper class, I found very verbose to serialize Json every time and deserialize it when sending data to Firebase.

Thus I made a simple wrapper to simplify the process, while also introducing a retry mechanism and cancellation and timeout support.

Conclusion

Overall I’m quite happy with the end result and I’m looking forward to see what interesting things I can implement in the future.

I’m not sure if I want this to be a remote controlled toy car project anymore, it sounds good but I think it would be more practical If I could connect multiple sensors, create a simple interface and monitor my apartment using this, perhaps add some support to automatically water my plants, that would be nice.

The project is open source and can be found on my Github.

Thanks for reading!

My experience with .NET IoT (so far)

cover

I haven’t done any embedded development in a while and I was thinking to build myself a remote controlled toy car with video streaming.

The project is going to take me a while. To build it I’m going to use C#. I’m already too familiar with Python and a little challenge doesn’t hurt.

To interface with the hardware, I’m going to use the .Net Core IoT Libraries from Microsoft.


My idea was to create a set of .Net Core services that communicate internally via gRPC and an ASP.Net Core web application to control the car. (Now that I’m writing this I’m thinking that could possibly drop the web app and use gRPC directly from the client).

The client would be a desktop application that will display the video stream and data from the sensors. It should work with an Xbox controller or else it won’t be fun. 😦

To write it I will probably use Mono or Unity.


After burning the latest version of Raspbian on the board using Etcher and spending a few hours in Rider developing a base for the app. I’ve Installed .Net Core 3 SDK and ran the application. The results were amazing! I’ve checked the thermostat in the office and it was set on 25

readings

And the application only consumes ~10MB RAM! That’s awesome!


I’m really impressed and so far things are looking bright for dotnet/iot. I can’t wait to test the gRpc support and other hardware modules.

The full code can be found here: https://github.com/dnutiu/NucuCar

If you want to run the app on your Raspberry you’ll need to install the .Net Core Sdk (Instructions) and run the following commands:

git clone https://github.com/dnutiu/NucuCar.git
cd NucuCar
dotnet build
cd NucuCar.Sensors
dotnet run


Thanks for reading!

I hope you will give dotnet/iot a try for your next project!