Zander P.
Hi, my name is Zander and I am going to be a senior at the Urban School of San Francisco. My main project for my time at BlueStamp is a weather station base station that is based on this instructable. I chose this project because I am very interested in combining advanced hardware with custom software in new and interesting ways.
Engineer
Zander P.
Area of Interest
Undecided
School
The Urban School of San Francisco.
Grade
Incoming Senior.
Final Milestone
My third and final milestone was to program the base station to read temperatures from a sensor, keep accurate time and display the information on the LCD screen. This was extremely difficult to do as every piece required at least one library to work. In the end I have a total of 11 libraries in use for the code to function properly.
The code I wrote was based on the project on which I based mine. Unfortunately the code, at this point, was about a year old and the current parts were not available due to time constraints. While some parts are the same, such as the writing of the string which decides what to display for the humidity and temperature, the communication, for instance, is completely different and is based off virtual serial communication using an arduino Nano as a “middle man”, for lack of a better word. It communicates between the remote device using the NRF modules. For communication between the arduino Due and the intermediate, I used a virtual serial port combined with the the use of the Due’s extra TX and RX ports. Communicating without the hardware serial port became confusing and outputted incorrect values.
The code for the screen had to be rewritten from it’s original state because I was using a different screen and library, as I mentioned, to display the information. While it was close to the original code, i had to experiment significantly, often finding that I came up with a code that I didn’t actually need. Additionally, it took a lot of guessing and some basic math to display the UI in a useful and visually appealing way.
The RTC was pretty easy to use as the code and the library it used were still the same as the original project off of which I based mine. I did find it interesting, however, that the arduinos, at this point, do not just have integrated RTCs from which they can keep time with.
The final main piece of the code was the communication between the base station and the base receiver. This was used to take the code transmitted by the receiver and convert it into values that could be used by the weather algorithm for proper display of the data. This was my final challenge in this project because at the start of the project when making the wired connection between the base station and the receiver, I had no idea that virtual connections were possible, let alone necessary for the code to work properly. To get this part of the code to work, I used the virtual serial connection, made available through the SoftwareSerial library on the base station in order to transmit the information to serial port #1 on the arduino Due. On the Due there are a total of four TX and RX ports (four each) labeled 0-3, zero is the default and the one that is supposed to used for debugging, while the others are three hardware ports do not conflict with the main port. This gave me the choice to not use another virtual port, but rather a hardware one.
For sending the data between the receiver and the base station I needed to convert it into a string rather than the struct it was being sent as between the remote module and the receiver. Both the values were being sent at the same time as a string of ints (integers) that looked something like this: “<20114302>”. The two “< >” are for determining the start and end of the data string to make sure none of the data is lost or omitted. The first part of the string, in this case “2011” means 20.11 degrees celsius. This was done because float values are not able to be transmitted through the serial properly. If they were they would just be output as “20” without the “.11” on the end. The “4302” is referring to the humidity, meaning the value is actually “43.02 %”. Once the string is sent, it is placed into an algorithm to make sure it is all there. The algorithm looks for the two “< >” for opening and closing. Once the entire value is there, they are removed then converted into an array so as to separate the first four numbers and the last four. At that point they are divided by 100 to place the decimal in the right place, then printed to the LCD for display.
I greatly enjoyed my time at BlueStamp, I was able to do the project I wanted and learn the things I wanted without the lecture component of school. I enjoyed trying new things such as using TFT LCD screens, while also returning to the basics of coding and the logic behind it. Throughout my time at BlueStamp I overcame many challenges pertaining to hardware, software, and a blend of the two. It is such a nice feeling to be working on solving one issue for multiple days and for all the different part to fall in to place like they were meant to. While my specific project, a weather station, does not have much use with modern technology, it did however provide me with a welcome challenge and the opportunity to further my knowledge of coding and hardware manipulation.