Studio 5: Interactive LED Panel (completed) + small reflection #17
Finally I have made the interactive part of the LED panel work, but it is not entirely accurate. Here let me explain the process I’ve done to reach to this stage.
After I finished connecting the sensors on to the Arduino board together with the LED panel, immediately I was facing one of my biggest challenges- to write the code for the interaction. The interaction is that when people walks close to the sensor it will detect the person in front and will then send a signal to the LED panel and trigger it to automatically display names of plants on the screen. The original code that I had written before was very unstable as the sensor would stop working sometimes. Not knowing how to resolve the issue I sought help from Stefan and Kim. They suggested me to try using state machine. Basically a state machine is a model of computation based on a hypothetical machine made of one or more states. Only a single state can be active at the same time, so the machine must transit from one state to another in order to perform different actions. Through numerous online tutorials, getting help from staff and by trial and error I was able to understand the state machine computing model and to incorporate three states in my code; the 1st state event is sensor detecting an object/person standing very close in front of it. Once this is done the state machine then transits to the 2nd state in which the person is to remain in position for about 3 seconds. After this criterion is met the state machine transits to the 3rd state which is to display on the LED panel name of the corresponding plant that the person is standing in front of it.
I must say using the state machine has definitely improved the performance of the installed sensor but it has a delay that cannot be fixed if I wanted quality, so this interactive LED panel could only be deemed as a proof of concept rather than an actual final outcome.
Overall I really enjoyed using Arduino to make the interactive LED panel and have learnt a lot of things along the way, including how to use the “state machine”. From experience sometimes“hard work doesn't guarantee success, but without it you don't have a chance”. And in my case this function may not be perfect but the most important thing is that I was able accomplish my goal and get it to working in the end which is all that matters.