Difference between revisions of "F16: NotifyBox"
(→Schedule) |
(→References Used) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 78: | Line 78: | ||
| Integrating all peripherals | | Integrating all peripherals | ||
| Complete | | Complete | ||
− | | 12/19 | + | | 12/19 |
| Our schedule was backlogged by building an iOS app to connect Bluetooth, but all peripherals were implemented. | | Our schedule was backlogged by building an iOS app to connect Bluetooth, but all peripherals were implemented. | ||
|- | |- | ||
Line 85: | Line 85: | ||
| Testing | | Testing | ||
| Complete | | Complete | ||
− | | 12/20 | + | | 12/20 |
| Project is completed and working | | Project is completed and working | ||
|- | |- | ||
Line 378: | Line 378: | ||
== Testing & Technical Challenges == | == Testing & Technical Challenges == | ||
+ | |||
+ | Testing was done incrementally, testing each stage and step. We first interfaced the IR sensors first, testing it was done by blocking the signal to check for delivered mail. Secondly, wireless transfer was verified by testing if the received bytes were equal to the sent bytes. We were able to test up to an impressive range of 20 feet with wireless transfer still fully functioning. Thirdly, testing Bluetooth took by far the most time. After many days and weeks of testing, we were confirmed what we didn't want to hear - that it was not possible to interface the HC-06 bluetooth module with iOS. At that point, we chose to still work on our project for Android. We opted to use a Bluetooth Terminal to verify the validity of our Bluetooth transfer. After putting all the peripherals and assembling everything together, we were able to test NotifyBox as a whole system by inserting "mail" (in our case, a piece of cardboard) into the mailbox. The SJOne board recognizes there's mail via the IR sensor. At once, the SJOne board will send data to a different SJOne board wirelessly. Once that board receives the data, that same data will be sent via Bluetooth to our phone using a Bluetooth Terminal App. Our project was completed and verified to work; a live demo can be seen below in the project video section. | ||
=== Issue #1 === | === Issue #1 === | ||
Line 418: | Line 420: | ||
*[https://www.youtube.com/watch?v=9iXo3P6JX0s Wireless/Mesh API video] | *[https://www.youtube.com/watch?v=9iXo3P6JX0s Wireless/Mesh API video] | ||
+ | |||
+ | *[https://cdn-learn.adafruit.com/downloads/pdf/ir-breakbeam-sensors.pdf IR break beam] | ||
=== Appendix === | === Appendix === |
Latest revision as of 01:57, 21 December 2016
Contents
Abstract
With the rise of e-commerce, online shoppers are receiving more mail than they ever have before. This increase in online shopping will also come with an increase of mail and packages received. NotifyBox will help consumers remotely be more aware of when packages/mail has been delivered to their mailbox. NotifyBox will provide users with a notification on their phone showing when their mail has been delivered. An IR beam will be used to check when mail is received. This will be interfaced to an SJOne board. Once mail has been detected the SJOne board will send the data to another SJOne board over wireless communication. The second board will then communicate that data over Bluetooth to a phone. Every time the beam has an interference, the user will receive the notification on their phone.
Objectives & Introduction
The objective of this project is to create mailbox that will remotely notify a user when mail has been delivered. Upon mail being received in the mailbox, a notification will appear on a user's screen that mail has been received.
- Interface infrared sensor
- Transfer data to SJOne board
- Communicate two SJOne boards over wireless communication
- Send data from SJOne board using Bluetooth
- Connect to phone via Bluetooth
Team Members & Responsibilities
- Eric Lau
- Bluetooth interface
- UART communication
- Alex Zavala
- Infarred beam detection
- Wifi interface
Schedule
Week# | Date | Task | Status | Date Completed | Notes |
---|---|---|---|---|---|
1 | 10/21 | Finalize Project Idea and Porposal | Completed | 10/28 | Decided on idea and finalized proposal |
2 | 10/28 | Order Parts | Completed | 11/2 | Received parts on 11/2 |
3 | 11/4 | Familiarize with Datasheets | Complete | 11/11* | *Ongoing process, will continue to familiarize datasheets |
4 | 11/11 | Design circuit diagrams and IR sensor communication | Complete | 11/30 | Implemented using GPIO |
5 | 11/18 | Interface Bluetooth and research iOS app | Complete | 11/25 | iOS app was started very eary (11/13) and bluetooth part was started 11/20, but not fully completed until later. |
6 | 11/25 | Interface WiFi and complete iOS app | Semi-Complete | 12/19 | Although the WiFi was done and iOS was almost done, the app was not completed until Bluetooth was fully functioning. Concluded that it is impossible to interface HC-06 to iOS. |
7 | 12/2 | Integrating all peripherals | Complete | 12/19 | Our schedule was backlogged by building an iOS app to connect Bluetooth, but all peripherals were implemented. |
8 | 12/9 | Testing | Complete | 12/20 | Project is completed and working |
9 | 12/21 | Demo | Complete | 12/21 | Will be presenting to the class and demonstrating |
Parts List & Cost
Part Name | Part Number | Quantity | Cost | Notes |
---|---|---|---|---|
2x WiFi Transceiver Module 1MB Flash | ESP8266 ESP-01 | 1 | $9.95 | For interfacing WiFi |
Xbee Bluetooth Bee | Iduino Xbee V2.0 (HC-06) | 1 | $11.99 | For interfacing Bluetooth |
SJOne Board with LPC1758 | SJOne Board | 2 | $80.00 | Microcontroller used to control peripherals |
Jumper Wires 60 ct | 1 | $8.00 | For connecting pins | |
Infrared Sensors - 3mm LEDs | IR Break Beam Sensor | 1 | $1.95 | Sensor used for sensing objects |
WiFi antennas | Old WiFi antennas from router | 2 | $0.00 | Antennas used for wireless communication |
Total | $191.89 |
- NOTE:
- Bluetooth module HC-06 only works as a slave, not as a master peripheral. Will need to get an HC-05 if you would like to perform as a master and slave.
- The Bluetooth module is also not a Bluetooth Low Energy (BLE) module. If you would like to connect to an iOS device, you need to have a BLE module.
Design & Implementation
Hardware Design
Hardware Interface
In our block diagram, we have one infrared sensor(IR) that we will be using to determine if mail has been received. Once the IR sensor beam breaks, microcontroller 1 will receive that data. The IR sensor sends data to the microcontroller over GPIO interface. Once microcontroller 1 has the data it will package the data and then send that package to microcontroller 2 via wifi. When microcontroller 2 has received the package this will notify the user with a notification that mail has been received. The communication from microcontroller 2 to the iPhone will be done using a Bluetooth module.
Above is a table from the LPC 176x/5x User Manual. This table shows the pins that we used on the SJOne boards to interface the GPIO port for the Infrared sensor and the UART port to interface the Bluetooth HC-06 module.
- Board 1:
- The IR sensor has a transmitter and a receiver sensor. Both transmitter and receiver have a red and a white wire. These are to power the sensor. We are using 3.3 logic for the VCC of this project.
- The receiver has an extra white wire. This wire is used as an input for the GPIO port.
- NOTE: The receiver wire is an open collector. This means you need a pull-up resistor in order for it to work. Connect a 10K resistor between the white wire of the receiver and the red wire of the VCC.
- Nordic wireless was used with the wireless FreeRTOS API to send a packet of data.
- Board 2:
- Nordic wireless was used with the wireless FreeRTOS API to receive a packet of data
- UART ports are used to transfer data to the phone over the Bluetooth module. We used internal UART ports TXD2 and RXD2.
IR Beam Sensor
IR (infrared) beam sensor is a sensor that detects if something is blocking the path between an emitter and a receiver. The way that this infrared break-beam sensor work is having an emitter emit an IR beam that can is received by the receiver module. When something blocks the path between the emitter and receiver, the beam is "broken".
For our project, we used the IR Beam sensor to detect if the link is active or if there is a break/interference in the infrared connect between the emitter and receiver. When mail has been delivered, the infrared link will be broken, thus changing the state of the GPIO pin to true.
xBee Bluetooth Module
The xBee Bluetooth module used is made by Iduino. It interfaces a HC-06 Slave chip. The xBee peripheral allows us to pick to use either UART2 or UART3 to communicate. UART uses a RX for serial input and TX for serial output.
For our purpose, we chose to use UART2 because
This is the datasheet reference that we used to identify where the Tx and Rx pins were on the HC-06.
Software Design
- All the software was implemented on FreeRTOS. This is a free operating system that can be used to develop embedded systems. This Development Package is what was used to implement our project.
NOTE: We have two SJOne boards communicating to each other. Therefore, we have two design flow to illustrate two different implementations.
SJOne Board 1
- IR Sensor
The IR Sensor was implemented through a GPIO pin. The pseudocode is as follows:
init configure GPIO Pin
gpio_task
if (GPIO Pin is set) no mail else mail! send packet over nordic wireless (detailed in section below)
- Nordic Wireless (sender)
Onboard nordic wireless chip was used to send data wirelessly to another board. Below is the pseudocode:
init
configure wireless channel configure node address configure node name
wireless_send
set hops set address to send to initialize packet to send form packet of data to be sent send packet
SJOne Board 2
- Nordic Wireless (receiver)
Onboard nordic wireless chip was used to receive data wirelessly from another board. This is the pseudocode:
init
configure wireless channel configure node address configure node name
wireless_receive
if(packet received) deform the packet save data as variables send data over bluetooth
- xBee Bluetooth
Bluetooth was connected via xBee Wifly connection. Bluetooth drivers were automatically initialized. Pseudocode is as follows:
init
configure UART clock control bit configure Peripheral clock divider configure RX pins configure TX pins configure baud rate: set LCR set DLAB bit calculate divider configure DLM configure DLL clear DLAB bit
UART2_send(out)
set THR to out character while(1) //wait for character to be sent if(LSR is clear) break
- Bluetooth Terminal (phone app)
To verify that data was sent over Bluetooth, we used the "SENA BTerm" Android app. Pseudocode for Bluetooth transfer:
init
initialize connection to HC-06 Bluetooth module
Bluetooth_receive
while(1) if(received) output data on app screen.
Implementation
- NOTE: Due to using two SJOne boards we are implementing two different designs on separate laptops.
- SJBoard 1:
- To initialize the GPIO:
- Enable power.
- Initialize pin to port 2.0
- Set direction of the pin as an input.
- To implement Nordic wireless send
- Create a sender function
- Sender function will send data to a specific receiver address.
- Data will then be formed into a packet.
- After formed function will then send the packet.
- Main function
- An if-else statement in your main tasks will then be need to check to see if the IR beam has an interference.
- If the (else) statement is executed then call the wireless send function.
- SJBoard 2:
- To implement Nordic wireless receive
- Create a receive function
- Receive function will receieve data from the sender.
- If statement that checks to see if a packet was received.
- Function will check if a packet was received.
- If received will then deform the packet.
- Main function
- Call the receiver function. If received, send data from the packet over to the phone over Bluetooth.
Testing & Technical Challenges
Testing was done incrementally, testing each stage and step. We first interfaced the IR sensors first, testing it was done by blocking the signal to check for delivered mail. Secondly, wireless transfer was verified by testing if the received bytes were equal to the sent bytes. We were able to test up to an impressive range of 20 feet with wireless transfer still fully functioning. Thirdly, testing Bluetooth took by far the most time. After many days and weeks of testing, we were confirmed what we didn't want to hear - that it was not possible to interface the HC-06 bluetooth module with iOS. At that point, we chose to still work on our project for Android. We opted to use a Bluetooth Terminal to verify the validity of our Bluetooth transfer. After putting all the peripherals and assembling everything together, we were able to test NotifyBox as a whole system by inserting "mail" (in our case, a piece of cardboard) into the mailbox. The SJOne board recognizes there's mail via the IR sensor. At once, the SJOne board will send data to a different SJOne board wirelessly. Once that board receives the data, that same data will be sent via Bluetooth to our phone using a Bluetooth Terminal App. Our project was completed and verified to work; a live demo can be seen below in the project video section.
Issue #1
Bluetooth implementation on the iOS app was by-far the hardest part of the project. After hours, days, weeks spent on interfacing our xBee HC-06 Bluetooth module, we found that it was impossible to have the HC-06 discoverable by iOS (iPhones, iPads, iPods). Because the HC-06 does not use with Bluetooth LE, and is not MFi certified, it was considered to be not following Apple's standards, thus not allowing any HC-06 Bluetooth modules to be able to be paired with iOS devices. We had to change our approach on our objectives. We opted to use a Bluetooth terminal app in Android to talk to our xBee HC-06 module.
Issue #2
The wireless communication gave us a very hard time to transfer the data from one board to the other. Thinking that the way that we implemented it was incorrect, we were trying to fix our code for many hours. It wasn't until we decided to try to attach antennas to our SJOne Board that it then started working properly. Our issues was instantly resolved with antennas.
Issue #3
When first trying to research about how the Infrared (IR) sensor worked, I was not able to fully understand how to implement the sensor with the SJOne board as the sensor was made for Arduino. With enough research and asking my professor what I had thought was the best way to interface the IR sensor, I was told that I was over complicating myself. Was resolved by simply interfacing with GPIO.
Issue #4
On the hardware side, the wire connections for the IR sensors were very frail and thin. Although the wires were connected, sometimes the IR sensors would not work as intended. We concluded that either we would have to wirewrap the wires onto the GPIO pins, use banana plugs for a more secure connection, or we could fold and double the wires so then it would be a thicker connection. We ended up opting for doubling the wires because it would be the most efficient and seamless way to integrate it into our project.
Conclusion
In conclusion, NotifyBox was a successful project where we learned how to implement an IR Sensor over GPIO, utilize wireless transfer using Nordic Wireless, and sending data over Bluetooth to another device. Although we were not able to accomplish our initial plan to send data over Bluetooth to an iOS device because of hardware constraints (Apple iOS devices does not recognize some Bluetooth devices), we were still able to send data to an Android device over Bluetooth. A great deal and most of our time was spent on interfacing Bluetooth and secondly, working with wireless transfer. In the end, we learned a lot from this project and this class. We were able to learn how to use FreeRTOS as an operating system for our LPC 1758 microcontroller. We definitely learned a lot about Bluetooth standards, types of Bluetooth, and the services/characteristics of Bluetooth because of the time working with Bluetooth. If we were to do this project all over again, we would pick different components that would be complaint with Apple's hardware. We are still glad and proud of the outcome of our project. Future enhancements of NotifyBox includes a standalone app for Android and iOS, and using different components that would could detect the type of mail (package or letter), and the weight of mail.
Project Video
Project Source Code
References
Acknowledgement
Professors