Week two we connected a motor to the MSP430 but as the chips output is too low to power a motor so we needed to add a power chip, a SN754410NE chip in this case. As we wanted to do more with the motor than just turn it off and on like we did with the LED, we needed to add to the circuit to incorporate the power chip and change the code so we can chose the direction of the motor and later the speed.
First we went about setting up the circuit as shown below:
After we set up this circuit we found out that this was the wrong circuit so we had to remake the circuit like shown below:
The circuit was very similar to the previous one so it wasn’t too much of a set back. In line 1 the power rails on both sides are connected by having three diodes in series, two plain diode and one LED, the reason for this is to drop around 3V across them to have one 3V rail and one 6V rail on the other from the batteries. Instead of the three diodes we used a voltage regulator to be sure of having 3.3V on the left power rail. Another change we made was changing the four resistors connecting the two chips to plain wires, firstly because their only use was to protect the chip if we miss wired the chip and secondly there wasn’t any 1K ohm resistors in the lab.
There was one problem with the voltage regulator that the legs where too short to fit into the board so we had to solder on legs to the regulator which was a bit difficult, that was because the regulator was sensitive to heat and that the legs were very small and difficult to solder. After one burned out regulator we had one working and after testing was giving out 3.4V. That was the end of the circuitry, next was the code.
As like before we were given a sample code to see how the chip worked for a motor and after that worked we could play around with the code and see whats happens, which we did by getting the motor to turn in all directions for different amount of times. Unlike last time there was no challenge but we were giving the task of getting the motor to react to an external input, in this case a limit switch. We connected the limit switch to the 3.4V line, pin 3 on the micro controller and ground. We wrote a code that made the motor go forward when the switch was on and reverse when the switch was off, which worked…. partly. When the switch was on, the motor went forward but when it was off, it continued going forward. After getting some advice from one of the lecturers they said to add a pull-down resistor on the switch to stop the floating voltage on the switch and also any leakage currents. After doing this the code still didn’t work and the problem must’ve been in the code. But at this time it was the end of the class and we decided that the problem could be fixed next class as we had an idea of fixing it.