HyperRail First Run

Abstract:
We took our first set of data of the pine seedlings using the HyperRail and hyperspectral camera. This post will be a summary of our setup for the data collection. 

Objective:
Inform about our setup of the HyperRail and give an overview of the data collection.

Setup
We are using 9 meters of V-Slot (aluminum extrusion), a gantry set (rolling base), all the 3D printed parts located here, this attachment, an Arduino UNO, and the Big Easy Driver. The code is also located in the code section of the main page of this project. 

Data collection Steps

1. Upload the sketch to the Arduino Uno and connect the computer to the microcontroller

2. Run Processing sketch and wait for the list of ports to appear on the bottom of the IDE of processing. It will say something like, “/dev/tty…” or “com#”


Screen Shot 2018-03-07 at 12.50.40 PM.pngScreen Shot 2018-03-07 at 12.50.40 PM.png

3. Change the port that the microcontroller is connected to in the code. Note that the ports are enumerated starting at the index of 0. An example would be, ” /dev/cu.Bluetooth-Incoming-Port /dev/tty.usbmodem621″ you would select port 1. Here is an example of the change of the port: 


Port located at index 0Port located at index 0

Port located at index 0


Port located at the index 1Port located at the index 1

Port located at the index 1

4.Run the code again and wait for the IDE to say “GUI setup complete” and a single “r”. The “r” is very important because that means that the microcontroller is communicating with the application and is ready to receive a command from the application; the are stands for ready. After this step, the HyperRail is ready to go. Now we need to setup the hyperspectral camera. 

5.Insert the camera in the case and then bolt in from behind or put a strap on the front. The bolts or strap are there for extra safety, not really neccesary, but it is still good to have. 


IMG_0286.jpgIMG_0286.jpg

6. Hook up the battery and turn on the camera.

7. Attach ethernet cable and start the data collection.


IMG_0305 2.jpgIMG_0305 2.jpg

8. Detach the ethernet cable. 

9. Star the HyperRail and wait for it to travel the rail. 

DEMO VIDEO:

Here is an example fo the data collected from the hyperspectral camera:


preliminary_data_spectralsignature.pngpreliminary_data_spectralsignature.png

Conclusions:
The HyperRail is working well. We will now move to improving the GUI for more functionality and upgrade the electronics for autonomous operation. This means that the sensor will in charge of moving the HyperRail’s carriage to where the sensor needs to be. We will be implementing the Feather microcontroller from Adafruit to do this because it has a LoRa radio to be able to communicate easily between feathers. I also need to run validation tests for the performance of the HyperRail to verify the precision of the movement of the carriage.

GUI or CLI for the HyperRail 🤔… why not both?

Abstract:
The HyperRail is currently being controlled by the Arduino’s command line interface or CLI. But it is quite the process to change some parameters and restart the program; this whole process is not user-friendly especially if you have never used the Arduino IDE or have any coding experience. To make it easier to use I created a graphical user interface or GUI. 

Objective:

  • Create a GUI for the HyperRail so that the system is easier to use compared to using the command line interface.

Design:
For this part of the project, I am using Processing to create the GUI. This is an open source and cross-platform interface for writing code geared towards a visual processing of data and it has over 100 libraries that are readily available to make it easier for you to code. Another cool thing is that if you already use the Arduino IDE, then this IDE is going to look very familiar:


Screenshot of the two IDEs. Left is Arduino and right is ProcessingScreenshot of the two IDEs. Left is Arduino and right is Processing

Screenshot of the two IDEs. Left is Arduino and right is Processing

This is what the current GUI for the HyperRail looks like:


Screenshot of the HyperRail GUIScreenshot of the HyperRail GUI

Screenshot of the HyperRail GUI

I initially had the GUI controlling the Arduino using a library that the Processing software had already, but the problem came when I tried controlling the stepper motors from the GUI. What was happening is that the software does not have a delayMircroseconds() function making the controlling of the stepper motors very difficult. This is due to the fact that the function controlling the stepper motors is using microsecond-delayed pulses to move the motors. I think the reason it doesn’t have one is that it would not be able to communicate fast through the serial port. After doing more research online, I came to the conclusion that the best way of fixing this problem would be to have them be independent of each other, meaning that the Arduino would have control of the stepper motor and only be receiving triggers from the Processing. This also means that processing will be doing all the calculations to determine the total steps needed to travel the length of the HyperRail and conversion from velocity(mm/s) to RPM, this way the Arduino only is dedicated to moving the motor and not performing any calculations. 

What I ended up doing is having the microcontroller send a signal to the application and then, having acknowledged that signal, have the application send the option the user chose and numbers it calculated over to the microcontroller. The microcontroller will then parse the incoming string and extrapolate the values it got from the application to then use them to move the motor at the correct speed and direction. Here is a demo of what the GUI does:

Conclusion:
The GUI’s basic functions are all almost operational. At this moment I need to finish the code on the Arduino side for the parsing. After that, I will be doing some testing to see it actually works and then finish up incorporating the slider bar for quick positioning and the “Go to location” option so that the user can input specific location along the length of the rail and make the carriage go to it.