Arduino check states in Home Assistant

Hello. I tried to connect Arduino to Rpi - this works great. I also have idea to not only control Arduino Pins, but also to check states of each pin (when some pin state changes).
Unforunately using USB It’s impossible to read state from Arduino (not mention sensor data eg temperature and so on). I know I need to connect Arduino using and communicate the states viaMQTT but how to do it? Could you guys give me some feedback on this?