So I have to figure out the logic for a line follower robot using at maximum 8 NAND gates (2 7400HC series NAND circuits).
The robot has 3 sensors, which give 1 on a black surface and 0 on a white surface. The robot has 2 motors, one on the left and one on the right.
Below is the truth table I have made. A, B and C for the individual sensors. "LM" for Left Motor and "RM" for Right Motor.
\begin{array}{|c|c|c|c|} \hline A& B & C & LM & RM \\ \hline 0 & 0 & 0 & 0 & 0 \\ \hline 0 & 0 & 1 & 1 & 0 \\ \hline 0 & 1 & 0 & 1 & 1 \\ \hline 0 & 1 & 1 & 1 & 0\\ \hline 1 & 0 & 0 & 0 & 1 \\ \hline 1 & 0 & 1 & 1 & 0\\ \hline 1 & 1 & 0 & 0 & 1\\ \hline 1 & 1 & 1 & 1 & 1\\ \hline \end{array}
My aim is that the robot tries to get the black line either under sensor "B" or when the line is wide enough, under all sensors.
Next i made the K-Maps for both motors. Left motor first.
\begin{array}{|c|c|c|c|} \hline LM& & AB \\ \hline && 00 & 01 & 11 & 10 \\ \hline C& 0 & 0 & 1 & 0 & 0 \\ \hline & 1 & 1 & 1 & 1 & 1 \\ \hline \end{array}(Sorry for the scuffed K-map)
From which I got the function
F=C+A´B
Then the K-Map for the right motor.
\begin{array}{|c|c|c|c|} \hline RM&& AB & \\ \hline && 00 & 01 & 11 & 10 \\ \hline C&0& 0 & 1 & 1 & 1 \\ \hline &1& 0 & 0 & 1 & 0 \\ \hline \end{array}
And the function
F=BC'+AC'+AB
I have two main problems.
- How do I use De Morgans laws to convert these functions to use NAND gates only? I don't quite understand them.
- How do I combine these two boolean functions? Does that come naturally after converting the individual functions to use NAND gates?
Using Logic Friday 1, I generated three solutions:
Sadly, none of them fits in two
4 x NAND2ICs.Is it possible to revise the truth table to make it simpler? What purpose do the three sensors have?