As my first foray into the world of connected sensors, I chose to use a photo-resistor. Placed next to my bedroom window, this little guy will send values between 0 and 1024 to an MQTT broker.
Its an extremely simple setup, with an extra LED should I choose to add any additional functionality. I use an MKR1010, but I could only find an MKR1000 part for fritzing.
I first made sure the serial communication was working and the values I was receiving were correct. In a previous attempt, I had short circuited my my Arduino which had made it unresponsive. It took a while for me to figure out but reminded me of the value of taking these things one step at a time.
I found my topic and subscribed to it using Don Coleman’s basic MQTT client file which can be found at this repository. I also based my Arduino code off of the code found in the same repository.