Search code examples
javaspring-bootraspberry-pi

Access Raspberry Pi modules from Spring Boot application


Is it possible to access Raspberry Pi from a Spring Boot Application (possibly running on docker container on that RPi), for example using Pi4J or do I need to create an itermediary app that would communicate with the spring boot app?

For context - I need to create a web application that would allow remote control of several DC Engines.


Solution

  • What I understand you want to do is:

    Have a Web/Rest Application running on a Pi that allows you to control things like GPIO, PWN, I2C functionality on the Pi. This is possible using pi4j. You can find the details at https://pi4j.com/.

    This library will allow you to control things like GPIO, PWM, Servos.

    Do note that I am not sure of the intricacies of running this pi4j based application inside a docker container as it requires access to native system which will be abstracted out in the docker env.

    I would suggest building a regular app running natively and then work on moving it into a docker image.

    Note: By DC Engine I am assuming you mean DC Motors.