When starting with a bare Arduino device, our teams first step was to brainstormed various ideas and combinations that could be combined with Mat-Lab to create something that was both practical as well as creative.
Step 1: Building a Circuit That Included a Button to Play a Sound Through Mat-Lab.
From our original ideas, our team decided to create a circuit that included a button wired to the Arduino circuit board. Would would then press this button which would cause for the circuit to ether be opened or closed. After wiring the button correctly, we coded Mat-Lab to assign the button's outputs of open (1) and or closed (0) to the variable labeled 'button.' Based on the output, either a 0 or 1, Mat-Lab would then execute one of two commands. If 0, Mat-Lab would display a message to the conductor about our groups love for EF230. But if the 'button' variable read 1, then Thomas the Train's themes song would play out of the trains loud speaker. This would mimic the conductors ability to press a button to either sound the horn or play music and public instructions through a loud speaker attached to the train.
Step 2: Wiring a Rain Sensor to Let the Conductor Know the Condition of the Track
After wiring the button and coding Mat-Lab to play Thomas the Train's theme song. We created another more complicated circuit that involved a rain sensor. We began by correctly attaching the rain sensor to our Arduino circuit board and then began to write a Mat-Lab code that would read and translate the voltage outputs coming from the rain sensor. This sensor communicated differently from the button we wired at the beginning because instead of having analog communication like we did with the button, the rain sensor used digital communication when it returned voltage readings to Mat-Lab. Based on the voltage value returned from the rain sensor, we found that a higher voltages closer to 5 volts meant that the track was dry and voltage readings closer to 0 volts meant that the track was completely saturated. After getting the circuit completed and creating an if-else statement in Mat-Lab, we programmed Mat-Lab to return two outputs based on the voltage reading from the rain sensor. If the voltage found by the sensor was greater than 4 volts, Mat-Lab would turn on a green light bulb on the Adruino board and also display a message telling the conductor that the track was safe. If the voltage was between 2 and 4, Mat-Lab would return a caution warning display to the conductor and a yellow light bulb would light up on the Arduino board. And finally, if the voltage was less than 2 then a Danger message would appear and a red light bulb would glow on the Arduino circuit board. This was the mimic the situation as if the conductor was receiving thee messages about the condition of the tract while it was raining outside.
After finishing both sets of code and wiring both circuits separately, our team then wired both of the configurations together on the Arduino circuit board. In addition to this, we also combined our Mat-Lab code into a single file so that both code sequences could be ran together simultaneously. We then went through our code to make sure we labeled our steps clearly as well as improve any inefficiencies. This was the easiest part of the project as this did not take too much work other than just repeating what we had already completed and making it look neater, while make our code run more effectively.