To convert the given flow chart into multiple rows without any crossing lines or nodes, we can rearrange the nodes and adjust the connections accordingly. Below is a revised version of the flow chart in a horizontal, multi-row layout.
\begin{figure}[ht] \centering \begin{tikzpicture}[
process/.style={rectangle, draw, minimum height=0.7cm, minimum width=2.2cm, align=center, fill=yellow!10, font=\footnotesize},
decision/.style={diamond, draw, minimum height=0.7cm, minimum width=1.8cm, align=center, fill=red!10, font=\footnotesize},
startend/.style={ellipse, draw, minimum height=0.7cm, minimum width=1.8cm, align=center, fill=green!10, font=\footnotesize},
arrow/.style={-Stealth, thick},
node distance=1.2cm and 1.5cm,
scale=0.85,
transform shape
]
% Nodes
\node[startend] (start) {Start};
\node[process, right=of start] (sensors) {Read Sensors};
\node[process, right=of sensors] (json) {Create JSON};
\node[process, right=of json] (serial) {Send to ESP32};
\node[decision, right=of serial] (wifi) {WiFi Connected?};
\node[process, below=of wifi] (post) {POST to Flask};
\node[process, right=of post] (predict) {LSTM Prediction};
\node[process, right=of predict] (log) {Log to CSV};
\node[process, right=of log] (display) {Update OLED};
\node[decision, below=of display] (risk) {Risk Level?};
\node[process, left=of risk] (low) {Green LED\\Servo 0\degree};
\node[process, below=of risk] (mod) {Yellow LED\\Buzzer\\Servo 45\degree};
\node[process, right=of risk] (high) {Red LED\\Buzzer\\Servo 90\degree};
\node[process, below=of mod] (delay) {Delay 3s};
\node[startend, right=of delay] (loop) {Loop};
% Arrows
\draw[arrow] (start) -- (sensors);
\draw[arrow] (sensors) -- (json);
\draw[arrow] (json) -- (serial);
\draw[arrow] (serial) -- (wifi);
\draw[arrow] (wifi) -- node[above, font=\tiny] {Yes} (post);
\draw[arrow] (wifi) -| node[right, font=\tiny] {No} (delay);
\draw[arrow] (post) -- (predict);
\draw[arrow] (predict) -- (log);
\draw[arrow] (log) -- (display);
\draw[arrow] (display) -- (risk);
\draw[arrow] (risk) -- node[left, font=\tiny,yshift=-2pt] {LOW} (low);
\draw[arrow] (risk) -- node[above, font=\tiny] {MOD} (mod);
\draw[arrow] (risk) -- node[right, font=\tiny,yshift=-2pt] {HIGH} (high);
\draw[arrow] (low) |- (delay);
\draw[arrow] (mod) -- (delay);
\draw[arrow] (high) |- (delay);
\draw[arrow] (delay) -- (loop);
\draw[arrow] (loop) -| ++(-3.5,0) |- (sensors);
\end{tikzpicture} \caption{Flow Chart of Flood Risk Prediction System} \label{fig:flowchart} \end{figure}
The changes made include:
- Adjusting node distances for better spacing.
- Repositioning nodes to prevent line and node crossings.
- Some manual adjustments to node positions and labels for better readability and aesthetics.
This revised flow chart maintains the original structure and logic but presents it in a more horizontally expanded and organized manner across multiple rows.