Professional Documents
Culture Documents
RYB Design Document - Group 20 1
RYB Design Document - Group 20 1
Baby”
Complete Design Document
Version 3
18/01/2024
2
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
3
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
4
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
5
5.2.1 Functional Validation of the Output signal “Rocking Amplitude” of the product
after integration ............................................................................................... 58
5.2.2 Functional Validation of the Output signal “Rocking Frequency” of the product
after integration ............................................................................................... 58
5.3 Integration Validation ............................................................................................ 59
5.3.1 Integration test: communication ...................................................................... 59
5.3.2 Integration of the Submodules “Decision making” and “Motors drivers” .......... 59
5.3.3 Integration of the submodules “Heartbeat”, “Decision Making” and “Motors
Drivers” ........................................................................................................... 59
5.3.4 Integration of the submodules “Heartbeat”, “Crying”, “Decision Making” and
“Motors Drivers” .............................................................................................. 59
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
6
List of Figures
Figure 1(the frequency of heartbeat as a function of the stress percentage) .................. 9
Figure 2 the crying volume as a function of the stress percentage ............................... 10
Figure 3 High-level context diagram .............................................................................. 12
Figure 4 in depth context diagram ................................................................................. 13
Figure 4 Illustration of the design choice of the displays ............................................... 22
Figure 6 heartbeat circuit............................................................................................... 29
Figure 7 heartbeat circuit diagram ................................................................................. 30
Figure 8 heartbeat alternative 1 circuit diagram ............................................................ 31
Figure 9 heartbeat alternative 2 circuit diagram ............................................................ 32
Figure 10 The Crying Submodule ................................................................................. 34
Figure 11 bandpass amplifier circuit .............................................................................. 35
Figure 12 low pass filter with operational amplifier circuit.............................................. 36
Figure 13 crying submodule alternative circuit .............................................................. 37
Figure 15 decision making pynq display........................................................................ 39
Figure 16 explanation stress level ................................................................................. 39
Figure 17 stress matrix example ................................................................................... 40
Figure 18 decision making process ............................................................................... 40
Figure 19 the Motors-Drivers submodule setup ............................................................ 42
Figure 20 Circuit design built on LTspice ...................................................................... 43
Figure 21 Graph of initial and amplified signal .............................................................. 43
Figure 22 Circuit design built on the sub-module board ................................................ 43
Figure 23 Graph of the input and output signals obtained from an oscilloscope ........... 44
Figure 24 Alternative circuit design motor drivers ......................................................... 45
Figure 25 Alternative circuit design ............................................................................... 46
Figure 26 Oscilloscope view of bandpass amplifier ....................................................... 49
Figure 27 Oscilloscope view of the bandpass amplifier ................................................. 50
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
7
Figure 28 Oscilloscope view of the sound signal that is not filtered or amplified ........... 51
Figure 29 Multiple steps of the matrix displayed on the PYNQ LCD screen .................. 53
Figure 30 The baby setup’s lights turn on when the signals are received ..................... 55
Figure 31 The PWM-signal from the PYNQ-board ........................................................ 56
Figure 32 circuit with two transistors ............................................................................. 56
List of Tables
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Architecture and Requirement at Product Level (System level)
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Architecture and Requirement at Product Level (System level)
Figure 1.1.3.1:
The frequency of the heartbeat as a function of the stress percentage
300
240
250
frequency in BPM
200
150
100
60 60
50
0
0 20 40 stress in % 60 80 100 120
It is important to note that a certain delay is inherent in the heart rate’s response to a change in
the baby’s stress level. Because of this delay, the 'Decision Making' submodule may choose to
rely on stress percentage data from the 'Crying Detection' submodule, which provides more up-
to-date information, but only works when the stress level is under 50%.
2. Crying Intensity: This signal is captured by a microphone mounted on the cradle. The signal
may contain noise, which will need to be filtered in order to isolate the crying noise. The crying
sound is then analyzed to calculate the baby's crying intensity in decibels (dB).
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Architecture and Requirement at Product Level (System level)
As seen in figure 1.1.3.2, when the stress level is under 50%, the crying volume is strongly
correlated to the stress level. In this scenario, the ‘Decision Making’ submodule can use this
signal to accurately determine the baby’s stress level.
Figure 1.1.3.2:
The Crying volume as a function of the stress percentage
100%
Crying Volume (%)
80%
60%
40%
20%
0%
0% 20% 40% 60% 80% 100%
Stress (%)
Output signals:
1. Rocking Frequency: The cradle adjusts its rocking motion frequency based on the
input signals. This means that the cradle can change how quickly it rocks the baby. There
are 5 different available rocking speeds.
The specific rocking speed for each range are as follows:
2. Rocking Amplitude: This signal controls the cradle's rocking amplitude, varying
within defined regions. It determines the intensity or strength of the cradle's rocking
motion. The amplitude control ensures that the cradle can rock gently or more vigorously
based on the baby's needs, which is especially important when aiming to reduce the
baby's stress level. The amplitude values for each of the 5 available regions are as
follows:
Table 2(ragions and rocking amplitudes)
1 2 3 4 5
Region
20% 40% 60% 80% 100%
Rocking
amplitude
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Architecture and Requirement at Product Level (System level)
Table 3(Specifications of the Input signal “crying intensity input” of the product)
Specifications of the Input signal “crying intensity input” of the product
Unit Decibel (dB)
Timing information Sampled at a rate sufficiently large to accurately measure within the specified range.
Table 5(Specifications of the output signal “rocking amplitude output” of the product)5
Specifications of the output signal “rocking amplitude output” of the product
Unit Percentage (%)
PWM specification 1kHz 12V square wave. Duty cycle in Range 0% - 90%
Table 6(Specifications of the output signal “rocking frequency output” of the product)6
Specifications of the output signal “rocking frequency output” of the product
Unit Hertz (Hz)
PWM specification 1kHz 12V square wave. Duty cycle in Range 0% - 90%
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Architecture and Requirement at Submodule Level (Sub-system level)
Note that for signals “crying intensity input” and “heartrate input” the sample rate and
time to measure are not yet defined. These will need to be determined through testing.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Architecture and Requirement at Submodule Level (Sub-system level)
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Goal of each submodule
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Goal of each submodule
- Requirement for the Graphical User Interface/ Display 2: “Displayed data must be
easy to comprehend without the need of additional clarification”
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Goal of each submodule
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Signals description and specifications at submodule level (Sub-system level)
1.4.1.1.3 Alternatives specifications of the signal “crying volume” with justification analyze
what
Instead of sending the “crying volume” signal as soon as a change is measured, the “crying”
submodule could wait for the new measurements to differ from the previous signal by at least
some predefined minimum value. (e.g., a 5% difference). This would reduce the amount of data
that needs to be transmitted.
By mapping the data from a 0.0%-100.0% value to an integer between 0 and 255, the data can
be compressed to just 1 byte. (Using the “unsigned char” type). This way, transmissions could
be reduced even more. (Since an “unsigned char” is only 1 byte, while a “float” is 4 bytes)
This specification could be useful if communication between submodules turns out to be slow or
costly.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Signals description and specifications at submodule level (Sub-system level)
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Signals description and specifications at submodule level (Sub-system level)
whenever the desired rocking amplitude changes, the signal could be sent every 5 seconds, to
save on data transmission even more.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Goal(s) of the “Communication” submodule
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Design choices of the “Communication” submodule
2. Feedback Loop: Upon the receipt of any message, a feedback signal should be sent to the
sending entity. This "Acknowledgment" tells the sender the message was received and
processed. Upon receiving an error, an “Error” feedback signal should be sent.
In our current setup, we utilize UART for communication between submodules, which inherently
supports one-way communication on a single channel. This means the recipient cannot send
“Acknowledgment” or “Error” messages to the sender. To mitigate this limitation and enhance
communication reliability, we can implement robust error-checking mechanisms at the software
level. Additionally, we ensure thorough testing and validation of the data being transmitted
between submodules.
To further establish a feedback loop for acknowledgments, we propose utilizing General
Purpose Input/Output (GPIO) pins, allowing for acknowledgment signals to be sent over
separate channels. In our context, we could dedicate specific GPIO pins for sending
acknowledgment signals back to the sending submodule, thereby creating a reliable feedback
loop. This approach ensures that once a submodule receives a message via UART, it can
promptly send an acknowledgment signal through a GPIO pin, confirming the successful
reception of the message. This method enhances communication reliability while operating
within the constraints of our existing UART channels. Because of the high reliability of the UART
communication, this feedback loop will initially not be implemented, but will be noted as a
backup solution.
3. Data Encoding and Decoding: Efficient and accurate data transmission is paramount in our
system, necessitating the use of data encoding at the sender’s end and decoding at the
receiver’s end. This transformation process ensures that the data is in an optimal format for
transmission, allowing for seamless communication between different submodules. The
encoding process translates the data into a transmission-friendly format, while decoding
restores it to its original state for accurate interpretation and use.
Constraints:
1. No Delays: With a real-time system like this, latency should be minimal. Any delay in
communication can hinder the system's efficacy. (The communication should happen fast)
2. Space for Data: Ensure ample storage and bandwidth to accommodate all transmitted data
without bottlenecks.
3. Ease of use: The implementation of the communication must be easy to use. Both in
software (not needing too much code) and in hardware (not needing too many wires).
4. Timing: The timing requirements of the communication protocol must not be too strict. The
submodules must be able to focus on other tasks, while not having to constantly be checking for
incoming messages.
1. Communication Protocol:
We chose to proceed with the universal asynchronous receiver/transmitter (UART) protocol.
This choice supports quick and efficient communication between submodules, and it's reliable.
Inputs: Data received from other submodules (e.g., “Crying volume”, “Heartrate”).
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Design choices of the “Communication” submodule
Outputs: Processed data to be sent to other submodules (e.g. “Crying volume and Heartrate”
and “motor driver”)
Unit: Depending on the signal (% for “Crying volume”, BPM for “Heartrate”, Hz for “Rocking
frequency” and % for “rocking amplitude”)
Data Type: Float. Allows for high precision.
Refresh Rate: As fast as new data becomes available. The system is engineered to be able to
uphold a high refresh rate, ensuring that data transmission between submodules occurs with
minimal delay. This rapid data exchange is crucial for maintaining the real-time responsiveness
of the system, allowing it to quickly adapt to changes in input data and execute necessary
adjustments promptly. The design strives for a seamless flow of information, minimizing latency
to enhance the system’s overall efficiency and effectiveness in real-time decision-making and
actions. This can be done by using compact encoding and effective buffer management,
reducing processing overheads and considering using a Real-Time Operating System if
necessary.
Type: Digital (ensuring precise data transfer).
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Design choices of the “Communication” submodule
3. Message structure
UART uses serial communication. This means that the data is transferred one bit at a time over
a single communication channel. Each byte is sent according to libpynq 0.2.5's implementation
of UART.
To allow for larger data transfers, each message between submodules contains multiple bytes.
To maintain clarity and consistency in our communication protocol, each message follows a
specific structure:
• START_BYTE(1 byte) + SIGNAL_NAME(1 byte) + VALUE(4 bytes) + END_BYTE(1
byte)
Start_byte is a single byte that signals the beginning of a message, ensuring that the receiving
submodule is ready to interpret the incoming data. This must always have the value 255
(0b11111111)
Signal_name is a single byte that identifies which signal is being transmitted. It enables the
system to send multiple types of data over the same communication channel, assisting the
receiving submodule in correctly interpreting the incoming data.
Value is the main data payload of the message, consisting of a float value converted into 4
bytes. The use of a float ensures precision in the transmitted data.
End_byte is a single byte that indicates the end of the message, providing a clear marker to
help the receiving submodule understand when a complete message has been received. This
must always have the value 0 (0b00000000)
Feature Specification
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Design alternatives of the “Communication” submodule
Feature Specification
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Design alternatives of the “Communication” submodule
Alternative 2:
In addition to this we came up with an alternative design to use PWM communication without a
library. PWM is a square wave (turning on and off a GPIO pin), where the duty cycle (how long
the pin is on vs off) determines the value. In this case, a value of 0 would be fully off and 255
would be fully on. 128 would be on 50% of the time
This does cause major changes in terms of protocol and data types that we receive.
Table 9 features and specifications of Design alternative 2 of the Communication
Feature Specification
An advantage of the simplicity of PWM is that there is no overhead with start bits, stop bits,
parity bits like in UART. we can continuously keep sending the signal.
However, there are also major disadvantages, because this is a "bit banging" communication
method, there is no hardware here to help us (e.g. there is no data buffer, which means we
have to be very precise with our timing). This timing precision means the program constantly
needs to be checking for any incoming data, hindering the submodule's ability to focus on other
tasks.
Only the sending of the PMW data is implemented in the pynq library. So the receiving part
would be a lot of extra work. In this case we would have to implement this ourselfs, which we
wouldnt have to do for the UART Protocol.
In addition to this, the data we send with UART can be a lot more precise, instead of just
sending a value between 0 and 255, with UART we can send very small and very large values
with multiple decimals of precision. This is why we chose for our alternative using UART.
The unit for both these alternatives remains the same as our chosen design it depends on the
signal (% for “Crying volume”, BPM for “Heartrate”, Hz for “Rocking frequency”, % for “Rocking
Amplitude”). In alternative 2 the signal sent by the bits can be between 0 and 255, for a
percentage we would just use the 0 to 100. The same goes for the heartrate and rocking
frequency (we can just send it as a whole number between 0 and 255).
Comparison and Justification
While the PWM-based approach does offer continuous signal refresh, this comes at the cost of
increased complexity in timing management. Our final design choice (UART), therefore, strikes
a good optimal balance between speed, simplicity, and development efficiency, ensuring
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Tests of the “Communication” submodule
reliable communication between the PYNQ boards while minimizing potential pitfalls and
complexities associated with the alternative designs.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Tests of the “Communication” submodule
Goal of the test: Observe whether the Crying volume signal (in %) will be communicated from
crying volume submodule to the decision-making submodule. This value must also be shown in
the input and output sections on the corresponding submodules’ LCD screens.
Test set up: Two PYNQ boards are each connected to a computer with ethernet- and USB
cables. One will be the sender, while the other will be the receiver. The PYNQ boards are
connected to each other with wires as described in section 2.2. VS Code is used to run the test
and is open on both the computer screens.
Next, the test started. The crying submodule will create a simulated value for the crying volume,
that is constantly increasing.
The test will be considered a success when these conditions are met:
1. The crying volume is correctly displayed in the output section of the crying volume
submodule's display.
2. The crying volume is sent by the crying submodule.
3. The crying volume is correctly received by the decision-making submodule.
4. The crying volume is correctly displayed in the input section of the decision-making
submodule's display.
5. Both values displayed on the displays are equal.
6. The displayed values are observed to be increasing correctly.
Conclusion of the test: The crying volume is sent and received, and the correct value is
observed on both LCD screens. When the value changes on the sending submodule, the value
changes on the receiving submodule shortly after. This meets all given criteria. The test is
considered a success.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Tests of the “Communication” submodule
Conclusion of the test: The rocking frequency data is sent and received, and the correct value
is observed on both LCD screens. This meets all given criteria (Same criteria as “Rocking
Amplitude”. The test is considered a success.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Submodule “Heartbeat”
3 Design Descriptions
3.1 Submodule “Heartbeat”
3.1.1Goals and Guidelines for the Submodule “Heartbeat”
Aligned with Sections 1 and 2, our primary objective for the "Heartbeat" submodule is to safely
attach a measuring device to the baby. We plan to use an elastic for this purpose, ensuring
comfort. Additionally, our goal is to accurately interpret all four types of heartbeat patterns
generated by the LED and convert these into BPM values, which will then inform the stress level
calculations.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Submodule “Heartbeat”
V out
This setup allows us to detect the light variations from the LED beneath the baby's skin and
convert these signals into BPM values. The myDAQ kit interfaces with our computer. This way
we can see if the LDR receives light on the computer. If it receives light in periods we can
calculate the frequency of this in Hz. To calculate the BPM we will have to multiply the
frequency in Hz by 60.
When we have the bpm we are able to calculate the percentage stress. The formula we derived
from the given graph in the documentation is:
Equation 1
𝑠𝑡𝑎𝑟𝑡 𝑝𝑒𝑟𝑐𝑒𝑛𝑡𝑎𝑔𝑒
(𝑏𝑝𝑚 − 𝑏𝑝𝑚 𝑎𝑡 𝑠𝑡𝑎𝑟𝑡 𝑝𝑒𝑟𝑐𝑒𝑛𝑡𝑎𝑔𝑒) ∗ (𝑝𝑒𝑟𝑐𝑒𝑛𝑡𝑎𝑔𝑒 ℎ𝑖𝑔ℎ𝑒𝑠𝑡 − 𝑝𝑒𝑟𝑐𝑒𝑛𝑡𝑎𝑔𝑒 𝑙𝑜𝑤𝑒𝑠𝑡)
+
𝑏𝑝𝑚 ℎ𝑖𝑔ℎ𝑒𝑠𝑡 − 𝑏𝑝𝑚 𝑙𝑜𝑤𝑒𝑠𝑡
Equation 2
(𝑏𝑝𝑚−60)∗(100−10)
Percentage stress = 10 +
240−60
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Submodule “Heartbeat”
v out
The circuit includes a phototransistor with Mfr. No of LPT 80A, a Led with Mfr. No: C5SMF-RJE-
CU14QBB2, a resistor and a voltage source of 5 V. The phototransistor and LED are in series with the
resistor and powered by the 5V source. The LED has a voltage of 2V for the LED and a desired current of
20mA, we can calculate the resistor value using Ohm's Law:
R=(Vsupply-Vled)/I led
Where Vsupply is the supply voltage 5V, Vled is the LED's forward voltage 2V, and I_led is 20mA or
0.02A.
To calculate the resistor value:
R=(5V-2V)/0.02A
The calculated value for the resistor to achieve a current of 20mA with a 5V supply and a voltage of 2V
for the LED is 150 ohms.
Phototransistors are more sensitive to light than LDRs and faster in response to changes in light intensity.
They are sensitive to light from a particular direction, and they are usually more expensive than LDRs.
LDRs can detect light from all directions, however, they have a slower response time to changes in light
intensity compared to phototransistors. Their resistance is also affected by temperature, which can be a
disadvantage in some applications. The characteristics of LDRs can change over time with exposure to
light. LDRs are simple, easy-to-understand components. They are generally cheaper than
phototransistors. And they are smaller which is more comfortable for the baby.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Submodule “Heartbeat”
In conclusion, while phototransistors have their merits, the simplicity, cost-effectiveness, and
omnidirectional light sensing capabilities of LDRs make them a more suitable choice for our
needs. Their ease of integration into a variety of circuits without requiring complex support
components is particularly beneficial and LDR are more comfortable to wear for baby. All in all,
these factors are why we chose an LDR for our application.
v out
The LED has a voltage of 2V and Iled is 20mA, the LED is connected in series with the photodiode input
of the LTF converter. When light falls on the photodiode it generates a signal that influences the LTF.
R=(Vsupply-Vled)/I led
To calculate the resistor value:
R=(5V-2V)/0.02A
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Submodule “Crying”
The calculated value for the resistor to achieve a current of 20mA with a 5V supply and a voltage of 2V
for the LED is 150 ohms.
Considering these points, for this application requiring simple light, where simplicity, cost-
effectiveness, and lower power consumption are prioritized over the high precision and quick
response provided by light-to-frequency converters, we have chosen to use an LDR. Despite its
slower response and non-linear output, the LDR's passive nature and ease of use make it well-
suited for our application.
Another goal is to send the received signal from the heartbeat submodule to the decision-
making submodule.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Submodule “Crying”
First, we need to pick a cut-off frequency, so that we can calculate what values we need to
choose for the capacitor and the resistor for the high pass filter. This cutoff frequency should be
higher than the maximum frequency of the background noise, but lower than the minimum
frequency of the crying sound, to make sure no crying sound is filtered out and no background
noise is still left in. We also need to find the cut-off frequency for the low pass filter.
The cutoff frequency we chose for the high pass filter is 400 Hz. We chose this value because
the minimum frequency of the crying sound is 420 HZ, and the maximum frequency of the
background noise is 120 Hz. We picked a value close to the minimum frequency of the crying
sound, to ensure that all unwanted background noise is filtered out. For the capacitor value we
chose 1uF, and for the resistor value we chose 390 Ohms. As we used the cut-off frequency
formula that stated:
F(c)=1/(2*π*R*C)
Since we chose 400 Hz as our cutoff frequency, we can fill this in in the formula.
400=1/(2*π*R*C)
This leaves us with 2 unknown variables R and C. From this formula you can calculate R*C.
After doing this we found out that R*C was equal to 1/800*π, which led to us picking 1uF for the
capacitor value and 390 Ohms for the resistor value, because multiplying these values gives
you approximately1/800*π:
The cutoff frequency we chose for the low pass filter is 2kHz. We chose this value because the
maximum frequency for the crying volume is 1159 Hz, and the minimum value for the noise
produced by the microphone is 10kHz. We chose this value close to the maximum frequency of
the crying volume, to ensure that all unwanted noise from the microphone is filtered out. For the
capacitor value we chose 1uF, and for the resistor value we chose 81 Ohms.
F(c)=1/(2*π*R*C)
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Submodule “Crying”
Again, filling in the 2kHz in the formula leaves us with the unknown variables R and C. After
calculating that R*C in this case is equal to 1/800*π, we picked the values 1uF and 81 Ohms for
our capacitor and resistor.
We also used a UA741 op-amp for the band pass amplifier.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Submodule “Crying”
We already did this type of circuit before we knew that the best option would be a bandpass
amplifier, but during tests we saw that there are also unwanted frequencies past the crying
ones, so we opted for the option of building a bandpass amplifier.
The downside here would be that all unwanted frequencies past our crying frequency would
also pass through, which would not happen when building a bandpass amplifier.
Alternative 2: As an alternative we could just build firstly a high-pass filter and a low-pass filter,
and then build an amplifier. Again, when building that we would use the same values for both
the high-pass R and C and the low-pass R and C.
The downside of choosing this alternative would be that building the same circuit but with
another order of the components might not be as effective for a band-pass amplifier since
amplifying the signal before filtering might amplify unwanted frequencies or noise. In our case,
we would first filter and then amplify which would not lead to this happening.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Submodule “Decision Making”
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Submodule “Decision Making”
Timing
After taking a step in the matrix, the submodule waits for the stress level to change (based on
the incoming heartrate and crying volume). Once this has changed and has stabilized, the
algorithm can proceed.
If the stress level has not changed after some amount of time (for example: 10 seconds), the
submodule will assume it has made a wrong turn (because stress level should decrease on
every step) and will take a step back. Then, the algorithm can continue.
Note that both the time to wait for the stabilization of the stress level and the time to wait for the
signal to change remains undefined. These values will be determined by testing with the cradle
setup and will mostly be determined by the heartrate's delay to a change in stress level.
Testing:
The way we know if our algorithm works is by simulating. First, we made an algorithm that
makes a matrix with random numbers in it. It is important to note that this random matrix does
not pick up any input from the other submodules, it simulates so the values in this matrix are
completely random. Through that matrix we set a path from 1 to 9 those numbers represent the
stress levels of the baby. Then we use our algorithm to look if it will find the correct path through
that matrix. On the display we can see the answer in the right picture.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Submodule “Decision Making”
Inverse Model:
If the rocking amplitude and frequency are at a maximum, then we know for certain that the
baby is at the maximum stress level. The rocking amplitude and frequency are always known,
and the stress level can be calculated (with the heartrate and crying volume). However even if
all these values are known, there will not be a set relation between these values, because every
baby is different. That is why we need to explore the behavior of our baby to see how it
responds to different rocking amplitudes and frequencies.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Submodule “Decision Making”
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Submodule “Motors drivers”
In comparison with our normal algorithm, alternative 1 is inefficient, since it will check a lot more
stress levels than our normal algorithm. We cannot compare this alternative to alternative 2,
since this alternative changes the way our algorithm takes decisions, and the second alternative
does not touch the way our algorithm thinks.
Alternative 2:
As the second alternative we chose to wait for a constant delay after every step before our
algorithm chooses the amplitude and frequency. (for example: 10 seconds). (Instead of
continuing when a change in stress level is observed). This way the decisions might be more
reliable, at the cost of some speed otherwise gained by skipping the wait.
Again, the exact amount of time to wait must be determined through testing. In general, a longer
delay will make the data more reliable, while a shorter delay will allow the system to calm the
baby more quickly.
Because of the (possible quite significant) reduction in speed this alternative was not chosen.
By tuning the selected algorithm well, we are confident we can get fast, reliable decisions.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Submodule “Motors drivers”
In order to test the circuit design, we first used the LTspice software in the aim of
targeting the weaknesses and strengths of the design on a conceptual level.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Submodule “Motors drivers”
In this graph the green signal demonstrates the input signal received from the PYNQ
and the blue signal demonstrates the output signal sent to the motors. The blue signal is
measured over the transistor thus it is clear that the circuit works according to the
requirements.
Later, we proceeded to test the circuit design on the actual sub-module board.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Submodule “Motors drivers”
other is connected to the 10K ohm resistor and an NPN transistor (TIP132 Darlington
Transistor). The 10K ohm resistor here (which one end is grounded) acts as a protective
element by limiting the current entering the transistor to prevent any damage to it. In
addition, this specific transistor was chosen since this is a low-voltage application. Also,
BJTs have a lower voltage drop between the collector and emitter compared to
MOSFETS. This property will ensure a stable output as much as possible.
The Collector of the transistor is connected to ground, the Emitter is connected to the
motors (Motor F for frequency and Motor A for amplitude) and the Base is connected to
the AR3 and AR4 ports. The power source is set to supply a constant power of 12V and
a minimum of 0.8A of current. When a signal is received the switch closes, enabling the
12V power to be supplied to the motors. Therefore, the duty cycle from the square wave
with an amplitude of 5V (or less) will be mirrored as the signal with an amplitude of 12V
containing the same information. So, the data received from the decision-making
submodule will be transferred to the motors who will work according to the duty cycle of
these signals.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Submodule “Motors drivers”
Figure 23
19 Alternative circuit design motor drivers
However, this design alternative does not
serve the purpose of the requirements for the motors to work. The argument is that there is a
12V power supply connected to the cradle and the aim is to transfer that power to it. Therefore,
the most efficient way is for the transistor to be used as a switch that allows the current to flow
to the cradle. Here, the transistor is used as an amplifier. Although the duty cycles are correct
and the initial signal is amplified, this approach to the problem does not propose an efficient or
correct solution. Thus, this design fails to coordinate with the system as a whole.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Submodule “Motors drivers”
Alternative 2:
Although this design achieves to actually ‘amplify’ the signals, it fails to meet some of
the requirements. One reason for this is that the excess current flow caused damage in
the transistor. To prevent this, the transistor was later changed to a MOSFET (IRF540)
in the same circuit. That did not work as well since the threshold voltage for any
MOSFET available was higher than the voltage of signals received from the PYNQ.
Also, in either of these circuit designs with different transistors the signals were not able
to supply 0.8A of current.
Another reason this alternative failed is that the program written to imitate the original
signals could not send proper PWM signals.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Test of Submodule “Heartbeat”
4.1.1.2 Functional Validation of “The system must display the measurements and
continuously update the current heart rate in BPM, presenting this
information in a clear and user-friendly manner.” the Submodule “Heartbeat”
To ensure the user-friendly presentation of the baby's heart rate information, the system was
designed to continuously update and display stress percentages on the LCD placed on the
PYNQ board. The Heartbeat submodule was programmed to update and display the baby's
stress percentage on the LCD every 5 seconds. The displayed information included the current
heart rate in BPM along with corresponding stress levels. The information presented on the LCD
was designed in a clear and user-friendly manner, allowing caregivers to easily interpret the
baby's physiological status.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Test of Submodule “Heartbeat”
The BPM readings presented on the LCD were cross verified with the actual heart rate
measurements obtained from the LED's intensity pattern captured by the LDR.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Test of Submodule “Crying”
communication and interaction between the Heartbeat and Decision-Making submodules. Any
deviations in heart rate were accurately detected, reported, and processed to determine the
corresponding stress levels.
4.2.1.2 Functional Validation of “Able to separate the crying sound from the
background noise picked up by the microphone” the Submodule Crying.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Test of Submodule “Crying”
We were able to fulfill that requirement by building on the breadboard a bandpass amplifier and
just at its beginning we connected the microphone so the picked-up crying noises are being
filtered out from background noises that might have both low and high frequencies
We can easily see a difference between the unfiltered signal and the filtered one, as the
unfiltered ones is far more random, meaning that it fluctuates much more than the final one, that
displays only the frequencies between [420, 1159] Hz.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Test of Submodule “Crying”
Figure 27 Oscilloscope view of the sound signal that is not filtered or amplified
In the case above the band-pass amplifier is not connected to what the microphone receives,
therefore the signal is not filtered and amplified.
4.2.1.3 Functionality Validation of “Able to analyze the crying sound and calculate a
crying volume” the Submodule Crying.
We first tested the ability to analyze the crying sound by connecting the microphone to the
circuit and the circuit to the mydaq. This way we knew that the microphone and the circuit were
working properly. As can be seen in the pictures from section 4.2.1.2, the signal is correctly
amplified, and the low and high frequencies are filtered out correctly. After that, we connected
the circuit to the pynq board, and we used the ADC library, (analog to digital conversion), to
make sure the signal output from our circuit could be displayed on the pynq board, and the
crying volume could be calculated from the output signal. We did this by measuring the
loudness of the crying sound throughout the first 5 seconds, since the crying volume is the
highest at this point. The maximum volume measured within these 5 seconds is taken as 100%
crying volume. Afterwards, the volume is projected as a percentage of the maximum volume.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Test of Submodule “Decision Making”
4.2.1.4 Functionality Validation of “Able to send the crying volume to the Decision-
Making submodule.”
The crying volume is projected on the crying submodule PYNQ, and is sent to the decision-
making submodule. On the display from the decision-making submodule, there can be seen that
the crying volume signal has been received. This signal gets sent using the UART library.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Test of Submodule “Decision Making”
Figure 28 Multiple steps of the matrix displayed on the PYNQ LCD screen
We also made a graphical interface that shows where our algorithm currently is in the stress
matrix. The blue block shows where the algorithm is, the yellow block shows where it has been,
and the green block shows the current path. The test was successful if the algorithm could
reach the opposite corner of where it started, in the picture you can see that the test was
successful.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Test of Submodule “Decision Making”
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Test of Submodule “Motors drivers”
Figure 29 The baby setup’s lights turn on when the signals are received
And finally, we connected our submodule to the decision making-submodule to find out if we
can interpret the combined amplitude and frequency and send that to the motors. For that
purpose, the decision-making submodule sent out arbitrary amplitude and frequency signals.
Then, it was observed that the two submodules were successfully working together as the
values sent from decision making were displayed both on PYNQ and RYB setup screen. At the
end we were able to calm the baby down by correctly interpreting the signals and sending them
to the motors without any obstacles.
4.4.1.2 Functional Validation of “Able to provide the required amount of power to the
motors in order to initiate movement in the cradle.” the Submodule “Motor
drivers.”
For the motors to initiate movement in the cradle our circuit needed to supply at least a current
of 0.8A and a voltage of 12V. To do this, we needed to amplify both signals from <5V to 12V. In
order to do that we had built a circuit that mainly uses a transistor that will behave as a switch.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Test of Submodule “Motors drivers”
The output signal from the PYNQ-board, that contains the duty cycle information, controls that
switch. That is possible as the duty cycle is actually just the timeframe of the power delivered
and thus the switch stays closed as long as the duty cycle is present otherwise it stays opened.
Figure 25
The switch is then connected to a power supply that can provide us the 12V and >0.8A. The
switch will then allow the power to go from the power supply to the motors when it’s closed with
the according duty cycle from the PYNQ-board. Therefore, the motors will receive the same
duty cycle information that was received from the decision-making submodule but this time with
12V instead of <5V and around 0.8A.
Figure 30
26 The PWM-signal from the PYNQ-
Figure 31
27 circuit with two transistors
board
Figure 27
4.4.1.3 Functional Validation of “Able to start, stop or change the speed of the
cradle’s motion” the Submodule “Motor drivers.”
Our submodule can start, stop or change the speed of the cradle’s motion by interpreting the
command from the decision-making submodule. When we send out a duty cycle of zero, the
cradle doesn’t rock and when we send out a duty cycle of 0-90% the cradle will rock. The speed
of the cradle’s motion is controlled by the varying values of the amplitude and the frequency
duty cycle. This is validated by directly observing the movement of the cradle.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Test of Submodule “Motors drivers”
4.4.1.4 Functional Validation of “Able to maintain high voltage input for initiating or
sustaining movement in the cradle” the Submodule “Motor drivers.”
Our circuit should be able to handle a high voltage that we send manually from an outer power
supply because the high voltage doesn’t go through the part of the circuit that regulates the
switch. The 12V only travels through the transistor and that can handle more than 12V. If not the
transistor will heat up and eventually get burnt.
This is validated by observing the movement in the cradle for a certain amount of time. This
means the circuit works consistently and seamlessly, so the transistors can maintain a high
voltage.
Functional Validation of "Able to display the duty cycle information of the PWM
signals sent to the motors.” the Submodule “Motor drivers.”
The duty cycle information of the PWM signals are displayed both on the PYNQ and RYB setup
screens. The software of motors drivers was composed accordingly. This will be validated in
detail in section 4.4.2.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Test of Input signals of the product after integration
The same steps were followed for rocking frequency signal. Arbitrary rocking frequency values
were sent to first motors then the setup. It was observed on the setup screen that the correct
values of frequency in Hz were displayed.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Integration Validation
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Integration Validation
During the test, the system was able to partially calm down the baby. However, once the crying
submodule got involved, the test failed. The crying submodule’s measurements were not
reliable enough to be able to traverse the stress matrix.
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Integration Validation
6 Appendix A: Acronyms
Table 10 - Acronyms
Acronym Literal Translation
A Ampere
A Amplitude
BJT Bipolar junction transistor
BPM Beats per minute
C Capacitance (Farad)
Db Decibel
ECG-pattern Electrocardiography-pattern
E.g. Exempli gratia
F Farad
GPIO General Purpose Input/Output
GUI Graphical user interface
Hz Hertz
LCD Liquid crystal display
LDR Light dependent resistor
LED Light emitting diode
NPN transistor Negative-positive-negative transistor
Ω Ohm
PWM signal Pulse width modulation signal
Q1 Quartile 1
R Resistance (Ohm)
RYB Rock Your Baby
SPI Serial peripheral interface
UART Universal asynchronous receiver / transmitter
USB Universal serial bus
V Voltage
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>
Complete V-Design Document RYB Integration Validation
Date:
18/01/2024 Version 3 <RYB, 23/24, #20>