Raspberry Pi control arduino atmega

Hello, I thought I would share a project I have been working on for work. I'm using a raspberry pi to send commands to an arduino atmega 2560 which either turns on/off relays or takes an analog reading.

The raspberry pi software is written in C++ using QT Creator. It starts through user input then sends single to turn on X relay and sends command to read an analog channel at set increments. When designated time is finished it send command to turn on x relay then kills the timer.

The arduino software is very basic. simple case statement and either reads or turns on/off relay based on command.

DISCLAIMER: Both pieces of code are poorly written. I needed this working immediately so I hacked it to heck and back. I will be cleaning it up soon, but thought this may help somebody wanting to communicate with an arduino using c++ on the raspberry pi.

GITHUB: GitHub - aelmendorf/Reliability-Stress-System: Control for 8 current driver boards with 24 drivers/board

Thanks for reading, hope this helps someone!

That's great. However, you could probably use Firmata more easily. I know Firmata has Python support, not so sure about c++.

Isaac96:
That's great. However, you could probably use Firmata more easily. I know Firmata has Python support, not so sure about c++.

I had to look up Firmata, never heard of it. This is very interesting, thanks for the tip. I might consider it moving forward, however right now i don't have any more time to optimize the software, it works well enough for my needs.

Absolutely. The real advantage of Firmata is that it is already full-function and you don't have to waste any time messing with the commands. However, we all have time constraints. :slight_smile:

Isaac96:
However, we all have time constraints. :slight_smile:

If only I could write software all day every day :frowning: