top of page
Search

Week 4

  • Aquawesome
  • Feb 4, 2019
  • 2 min read

Some big moves were made during week 4! We finished our board design for the new BLE chip and sent it off for fab! We also were able to read from the temperature and humidity sensor; all thats left on that front is to convert the values to their respective readouts. Lastly, we also have a simple BLE feature working in the firmware. Oh, and we are also looking into Swift programming to make our iOS app. Like I said, big moves!


PCB Design:

As you can see, the board layout itself is quite a bit simpler. This is because we were able to get rid of a few components from the board we were repurposing, including the charge manager, an LED, battery plug, and accelerometer. The 3 terminals are for I2C outputs, relay outputs, and an 4 extra pins for other GPIO for added flexibility. A lot of time was spent making sure that this board was designed properly. Triple and quadruple checking pin connections to make sure we will have a functional board.


Firmware:

As of right now, we are advertising 6 characteristics; temperature, humidity, pH, conductivity, as well as two read/write characteristics for our relay switches. Something that we still need to work on is solving the issue of random timeouts. We believe this is rooted in the timing and sequence in which we call functions. After a bit of work we were able to mitigate this quite a bit, and believe that we will be able to iron things out to a satisfactory degree.


BLE Functions:

This is the main BLE function that handles connection and initialization. The function below also allows the phone user to update the value of the GPIO pin on the PSoC, allowing control of the relay switch.

These are the functions used to update the sensor and light values to the phone. These values are sent any time the user selects "read" in the app. Also notice the I2C read/write function calls in the updatepH() function. Doing this mitigates timeouts because the the read and write to the sensor and the delay associated with this command happens inside the BLE function call. It also makes the code in main.c a lot cleaner and easier to read.

I2C Communication with temperature/humidity sensor:

After going through the data sheet for the sensor, we were able to successfully read and write to/from the sensors. This sensor works a bit differently than the pH and conductivity sensors; an 8 bit command is sent to the sensor and dictates whether the sensor will return a temperature or humidity reading. The results gets sent back as a 16bit integer, which we have to break up into 2 bytes and then add together. To do this, we first multiply the MSB by 2^8, and then add that to the LSB. This essentially shifts the MSB over 8 bits, effectively allowing us to recreate the integer value stored in the 16bit value. This is not shown in the code as we have yet to decide if we want to do this conversion on the front end or back end.


iOS App:

As of right now, we are exploring the option of using Swift to develop our phone app. Swift is more or less based off of C++, so we thought it would be the more straightforward option as far as learning a new development software goes.


Next Week:

Since we have a class presentation to give at the end of next week, some of our efforts will be put into finishing that up. With that said, we plan on getting the relay board design completing and sent off for fabrication as well as make some progress on the app development. The app development will dictate some of the final details of our firmware so we don't imagine a lot of firmware development will be happening in this coming week. Thanks for reading!

 
 
 

Recent Posts

See All

Comentários


Blog: Blog2
bottom of page