10
Sensor Network Subsystem Guide Index Hardware Sensors MLX90621 MAX31855 Type K Thermocouples VL53L0X PCB Walkthrough of each part of the PCB and it’s function; Add reference to BOM Software Code Walkthrough of running code Troubleshooting Hardware Sensors MLX90621

Hardware - Rochester Institute of Technologyedge.rit.edu/edge/P17551/public/Customer Handoff/P17551... · Web viewReal Time Clock(DS3231): Used to capture the time of day for both

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Hardware - Rochester Institute of Technologyedge.rit.edu/edge/P17551/public/Customer Handoff/P17551... · Web viewReal Time Clock(DS3231): Used to capture the time of day for both

Sensor Network Subsystem GuideIndex

● Hardware○ Sensors

■ MLX90621■ MAX31855 Type K Thermocouples■ VL53L0X

○ PCB■ Walkthrough of each part of the PCB and it’s function; Add reference to

BOM● Software

○ Code○ Walkthrough of running code○ Troubleshooting

Hardware

Sensors

MLX90621

These sensors are currently instrumented onto the printer to record temperature values for the bottom of the heat bed. The idea behind this was to see if any useful information could be gathered to discern where cold spots were located on the bed. The reason why only four were used for this instrumentation is due to the fact that each sensor records values in a 16x4 array whose field of view is 60° by 15°.

Page 2: Hardware - Rochester Institute of Technologyedge.rit.edu/edge/P17551/public/Customer Handoff/P17551... · Web viewReal Time Clock(DS3231): Used to capture the time of day for both

(Additional Information can be found in both the Bill of Materials and the datasheet provided)

Based on the figure above, the reference pin shows that the four array sensors inside of the 3D printer are recording values vertically (from the front edge of the print bed to the back) and that the sensor farthest to our left (printer right) is where the data values start with the pixel at the farthest corner being the first data point.

The sensors run on I2C serial communication which means that they are connected to a two wire bus, clock(SCL) and data(SDA), with other components. To ensure the data from the sensors is readable, a pullup network is implemented on the clock line and the data line. This is simply done by connecting a resistor to the node shared by each respective pin with the other end of the pin connected to a 3V source.

Based on the information presented, having four sensors of the same slave address should not work, right? This is where the I2C multiplexer comes in, which will be further discussed in the PCB subsection of the hardware section.

These sensors are currently wired using male to female jumper cables. While this works in it’s current iteration, this is not an advisable solution for the final product and it is highly suggested that a proper is to be made for these sensors to eliminate any possible data reading errors.

Page 3: Hardware - Rochester Institute of Technologyedge.rit.edu/edge/P17551/public/Customer Handoff/P17551... · Web viewReal Time Clock(DS3231): Used to capture the time of day for both

MAX31855 Type K Thermocouple

(Additional Information can be found in both the Bill of Materials and the datasheet provided)

Due to their sensitivity and simplicity of operation, the thermocouples are being used to measure the ambient temperature of the printer. Four thermocouples are used in this current iteration of the sensor network to create a holistic thermal image of the area above the heat bed.

The thermocouples collect temperature data by taking the difference between the two metals used to create the thermocouple, labeled yellow and red, and amplifying the resulting voltage to be then turned into a readable value for the arduino.

Unlike the MLX90621 array sensors, the thermocouples obtains serial-clock input(CLK), serial-data output(DO), and chip select(CS) values through SPI which involves connecting these

Page 4: Hardware - Rochester Institute of Technologyedge.rit.edu/edge/P17551/public/Customer Handoff/P17551... · Web viewReal Time Clock(DS3231): Used to capture the time of day for both

the three pins associated with these values: CLK,DO, and CS, to digital I/O pins on the arduino MEGA 2560. For the thermocouples to operate, they are connected to a 3V source supplied by the arduino as well as ground.

It might be a wise idea in the future to implement more thermocouples as each additional thermocouple could help create a more accurate image of the ambient temperature in the printer. For instance, instrumenting thermocouples under the heat bed could help show what the temperature differentiation looks like moving from the bottom of the printer to the top.

VL53L0X

(Additional Information can be found in both the Bill of Materials and the datasheet provided)

The VL53L0X is a proximity sensor that is implemented into the sensor network to calculate the X,Y coordinates of the individual pixels in each sensor array. This is done by shooting a laser out that will hit an object inside of the distance tolerance of the sensor and and bounce back, producing a voltage. This voltage is then translated into a distance using software.

Matlab code was then created by the team’s mechanical engineer and then translated to Arduino code by the electrical engineering team.

Page 5: Hardware - Rochester Institute of Technologyedge.rit.edu/edge/P17551/public/Customer Handoff/P17551... · Web viewReal Time Clock(DS3231): Used to capture the time of day for both

Printed Circuit Board (PCB)

Walkthrough

Page 6: Hardware - Rochester Institute of Technologyedge.rit.edu/edge/P17551/public/Customer Handoff/P17551... · Web viewReal Time Clock(DS3231): Used to capture the time of day for both

(Additional Information can be found in both the Bill of Materials and the datasheet provided)

1. SD/MMC Card Breakout(BOB-12941): Used for reading and writing data to the SD card, self-explanatory.

2. I2C multiplexer(TCA9548A): The multiplexer is implemented as a switch between the four array sensors. Every device that is controlled using I2C serial communication has a unique slave address which defines the device in the wire bus. If there are multiple of the same device, then their slave addresses will be the same as they are set by the factory. Having devices of the same slave address on the same I2C bus will cause there to be data loss as the serial has trouble talking to these two devices at once. Using a switch, such as the I2C mux., allows devices of the same address to be in different inputs that are switched between in the chosen programing environment.

3. Real Time Clock(DS3231): Used to capture the time of day for both the sample as it is recording and the file itself. Arduino has it’s own internal clock however it counts up by milliseconds only to be reset each time it is turned off. The real time clock is powered by a cell which allows it to keep time for years.

4. Logic Level Shifter(BOB-12009): As the digital I/O pins in the Arduino Mega output 5v, a level shifter is used to step down that value to 3v as to not fry the SD breakout pins.

Software

CodeFor the sake of the next MSD team, the Arduino code for the sensor network has been

commented as to help the next user understand the flow path or lack thereof. For the sake of holistically evaluating the code, the start of this discussion will be on the basic structure of the Arduino IDE.

The two main bodies of code in Sensor_Network.ino, or any Arduino code, is the setup block and the loop block. The setup block is implemented for initializing any functions or devices needed for the rest of the code. To use Sensor_Network.ino as an example, the code begins by initializing the Baud Rate of the serial monitor, this must match what is listed in the serial monitor or it will cause a delay in sending data and the characters out from the monitor will be printed as a mismatch of random symbols.

From there, several lines of code are used as basic initialization checks to confirm that everything is properly connected. Once the code confirms that everything is initialized, the setup block checks for any existing CSV file names saved onto the SD card so that it can print a new, incremented one as to not overwrite any previously stored data. The setup block ends by printing the labels for the recorded data.

The second block of code, the loop function, is the main body of code and where your code actually executes. A very large part of this function is commented out; as labeled in the code itself, any commented out code is for the LED matrix function. The reason why it is commented out is due to the fact that the LED matrix was previously implemented on the

Page 7: Hardware - Rochester Institute of Technologyedge.rit.edu/edge/P17551/public/Customer Handoff/P17551... · Web viewReal Time Clock(DS3231): Used to capture the time of day for both

Arduino but, due to its memory demands, it caused any data collected from the proximity sensor to be inaccurate as well as causing write failures with the SD card. TO remedy this situation, it might be advised to have a separate FPGA for the LED matrix for any complex display functions. This is even advised on Adafruit’s website.

The code found immediately after this is a filter of sorts. The array sensors can sometimes store past data points in their dedicated memory which can lead to garbage values upon start up. An if statement is implemented so that these values are not written to the SD card and inconvenience the customer. To begin the recording, the user is prompted to press and enter ‘1’ into the serial monitor to initiate the recording. From there, the code switches between each array sensor using a switch statement read each sensor. With each iteration of the loop, data will be sent to the CSV file with the X,Y coordinates for each array sensor pixel being sent to the SD card after every four iterations of the loop.

The section of the code that is after the loop function is for the function called through the program. These functions are documented in the code as to how they work.

Walkthrough of Running Code

Once the program is uploaded to the Arduino and the serial monitor is opened, you will be prompted by this screen. As mentioned before, these values are meant for confirming that the sensors are currently reading values and that any garbage values are filtered out before recording. The first two lines are for initialization of the sensors as well as the SD card. From there, the name of the file that the Arduino is writing to is displayed while the next two lines display samples of the thermocouple readings, as seen in line 4, and the string of sensor array values, as seen in line 5. These are clearly not all of the array sensor values and, as it prints out to the serial monitor as a string, the capture has cut off the rest of the values. Fortunately they are not important for this example. The last line prompts the user to press ‘1’ to initiate the recording.

Page 8: Hardware - Rochester Institute of Technologyedge.rit.edu/edge/P17551/public/Customer Handoff/P17551... · Web viewReal Time Clock(DS3231): Used to capture the time of day for both

Once 1 is pressed, the serial monitor will display what is seen in the figure above. Little to no interaction is needed from this point, as the nature of this design is to be left running over night.

TroubleshootingWhy are my sensor array values reading only NaN?P17551 has run into this problem multiple times and it seems to be just an issue with the serial cable connecting the Arduino to the computer. Usually reseating the cable by unplugging it and plugging it back in works.The serial monitor is displaying an error with the thermocouples.This is likely a connection issue with the set screws that hold the actual thermocouple in the amplifier. This can be remedied by simply checking all of the thermocouple connections and rescrewing down any loose connections. In the event that the connections to the board are disconnected and reconnected and you are not sure if they are right, check to see if the number sharpied to the connection’s shrink wrap is up or down. For connections 1, 2, and 3 the number should be facing down as seen in the figure below:

Page 9: Hardware - Rochester Institute of Technologyedge.rit.edu/edge/P17551/public/Customer Handoff/P17551... · Web viewReal Time Clock(DS3231): Used to capture the time of day for both

while 4 should be facing up as seen in the following figure: