Download Safebright - Smart Streetlight System

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Parallel port wikipedia , lookup

Serial digital interface wikipedia , lookup

Power over Ethernet wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

Wake-on-LAN wikipedia , lookup

Transcript
PROJECT DESCRIPTION
Need Statement
Currently, when a streetlight loses power, it does not have the ability to alert the
utility/admin of the outage. A customer must call to report the outage. A contributing
factor to this is old outdated technology that has not been improved or updated in
decades. The Safebright System will change this. When an outage occurs on the
streetlight, the status will be transmitted to a user interface that will relay the
information to the admin. In addition, it will allow the location of the outage to be
known, which will greatly improve restore times and allow more information to be
determined. For example, multiple outages on the same fuse. The system will work
off of two separate checks. The first check will check to see if the Streetlight has
power. The next check will check to see if the bulb is simply blown on the Streetlight.
This will increase the effectiveness of knowing the issue before physically being at
the Streetlight in the field. The streetlights or household power status will
communicate through a wireless XBee network and connect peer to peer in order for
their current statuses to be accessed. A node placed on each street light will
communicate wirelessly with a single central station where the information will then
be accessible on a user interface. The signal will travel through a Peer-to-Peer (P2P)
network allowing for increased range.
Goal Statement
The Safebright System will be focusing on building a small scale model that will
fulfill the needs statement and will be easily scaled up for real world use, while
making it easy for anyone to visually see an outage and how the entire system
responds to it through the User Interface.
Constraints
Power
120v AC to 5v DC Power Supply for each Streetlight
Control
TI Beaglebone Black
Goal
Have wireless communications with Streetlights in
order to recognize outages when they happen (either
no power or bulb blown outages).
Frequency
of XBees
802.15.4 Stack (the basis for Zigbee)
Range of
XBees
300 ft Outdoor and 100ft Indoor
Streetlight 3D printed with 107 x 77 x 254 (mm) final dimensions
Body
User
Interface
User interface screen will be 10 inches which will
allow the program that checks for outages to be seen
easily by the user.
Design Specifications System Design
User Interface
The User Interface is made up of a Beaglebone Black, XBee series 1, LCD Screen,
and Wireless Keybaord/Mouse. The UI is the central communication between the
XBee P2P Network and is equipped with an XBee connected to the Serial UART1
pins of the Beaglebone. XBee devices are configured using X-CTU, a free multiplatform application by Digi. X-CTU allows each XBee device to be flashed with
personal settings, such as using a certain pin as a digital input. This initial setup
through X-CTU is done on a computer using an XBee explorer. To Control the UI, a
small keyboard and touchpad combo is used called the Rii Mini K12.
XBee Series 1
The Smart Streetlight network requires wireless transmitters that can communicate the
status of each individual streetlight to a central notification interface. Instead of
creating a wireless connection through the internet, wireless transmitters are installed
into each streetlight to create a private secure network. The transmitters chosen for the
task were XBee Series 1 devices. There are multiple types of wireless transmitters on
the market today but the XBee is well known and compatible with the hardware and
software used for this project. There are many different types of XBees to choose
from, but the XBee Series 1 fit the needs of the project for the lowest cost. Its
transmission range of 100ft indoors is lower than other models such as the XBee-Pro
or the XBee Series 2.5. If the project were to be scaled up and implemented into a real
world scenario the XBee-Pro would be preferred since it has an indoor range of 300ft
and an outdoor range of 1 mile. For the purposes of the project, the XBee Series 1 will
provide more than enough range while being demonstrated on a small scale model.
Backup Battery:
In the event of a power outage, the XBee device must stay powered with the aid of a
backup power supply. A Lithium-ion 3.7V 1000mAh battery was chosen as the most
efficient backup power supply due to its high energy density. Unlike a nickelcadmium or nickel metal hydride battery, the lithium-ion battery has a long cycle life
and does not have a high discharge rate. The lithium-ion battery also requires low
maintenance since there is no periodic discharge needed. The team considered using a
supercapacitor rather than a battery. A supercapacitor’s main advantage is that it has
virtually an unlimited cycle life, but since the project is only for demonstration
purposes, that aspect did not hold much importance. What drove the team away from
choosing the supercapacitor as the backup power supply was mainly its inability to
hold a charge. With its low specific energy, a supercapacitor can only hold up to a
fraction of what a battery can.
LED Lights:
An LED light is installed into each streetlight in order to show that power is being
supplied. The functionality of the LED meets all of the requirements for the Smart
Streetlight project. It can be installed into the circuit with ease and produce enough
light to show that the streetlight is powered. Its small size allows for it to not interfere
with the rest of the circuit that is already condensed into the small head of the
streetlight. The team stayed away from traditional incandescent bulbs since there was
no clear advantage for their use in this project. They are too bulky and are not nearly
as efficient.
Streetlight Model:
Each streetlight was designed and printed using a 3D printer. Choosing to use a 3D
printer for building the Smart Streetlight model was ideal for precise customization
and creativity. This allowed for the electronic hardware to fit snug into the head of
each streetlight. The plastic material in which each streetlight is made up of provides a
sturdy, lightweight model that can be secured to the display cart.
AC to DC Converters:
All of the components that will be drawing power within the model will draw no more
than 5 volts. Each streetlight contains an XBee Series 1 that draws 3.3V at 50mA and
an LED that draws 4V at 80mA. Each component requires an individual source of
power in order for a power outage simulation to be applied to a specific streetlight.
For the power to be generated and separated, 5V DC power converters supply each
component with power from the 120V AC power strip which then draws power from
a power outlet. The team chose to take basic cell phone chargers and modify them to
be able to fit into the design. This method was a cheap and efficient way to supply the
desired amount of power to the streetlights.
XBee Data Packets
Above is an example data packet containing the following features:

7E: Start Byte

0, 13, A2, 0, 43, 78, FF, 79: Source Address

0, 10: Digital Channel Mask
o
1st byte (0) for D10, D11, D12; 2nd byte (10) for D0:D7
o
Pin 4 is set to receive data

0, 10: Digital Sample Mask
o
Basically means pin 4 is currently active high (Receiving Signal)
o
If 4 becomes low, then becomes 0, 0
Since we are planning on using pin 4 and pin 2 to check the monitored device the digital channel
mask would equal 0x14 which in binary is bit 4 and bit 2 high, %10100.
Depending on whether or not these pins are receiving power, the digital sample mask will
change:

0x14: Both pins powered

0x10: Just pin 4 powered (Should be impossible)

0x04: Just pin 2 powered (LED blown but power still on)

0x00: No pins powered (Streetlight has lost power)
From these different parts of the data packets the Beaglebone will determine the status of each
monitored device from the digital sample mask and the location from the source address. Once
the status is determined the Beaglebone will display the data on the LCD screen so it can be
viewed by the system user.
Circuit Details
Each Streetlight will contain a Circuit that will allow the XBee to stay on and send
data packets while checking for two different types of outages. The first outage checks
for a main power outage, when all the power is lost to the streetlight. The second
outage will check when the LED light is blown. There will be two switches in this
circuit to simulate both of these outages as depicted in fig 8 below.
In the circuit above, the resistors for the XBee power and pins are not actual resistors.
They just represent where the circuit connects to the XBee. The pins labeled on the
circuit are accurate to the names of the pins on the XBee itself. The check pin that is
connected and associated with the main power of the circuit has a high-low voltage
threshold of 0.9 volts. This means that any voltage supplied to that check above 0.9
volts will result in the XBee reading high and anything below 0.9 volts will read a
low. This pin should be supplied a rough 3.7 volts under powered conditions. The
check pin that is connected and associated with the LED has a high-low voltage
threshold of 1.6 volts. This means anything above 1.6 volts will result is the XBee
reading high and anything less than 1.6 volts will read low.
The Power Toggle Switch is used to simulate a power outage. It disconnects the 5 volt
power supply from the entire circuit. When this switch is turned off the LED will lose
power, but the XBee will still be powered by the battery. The LED Toggle Switch is
used to simulate a blown LED. This will break the connection from the LED to
ground preventing the flow current through the LED. The XBee will continue to
receive power directly from the 5 volt power supply.
D1 – D5 are rectifier diodes. The primary function of the diodes D1 – D3 are to
prevent the backflow of current from the battery to the XBee checks. This allows for
the battery to continue powering the circuit when the main power has been lost
without getting false readings on the XBee checks. The diodes D1 – D3 also drop the
voltage down from 5 volts to a rough 3.4 volts. This is needed in order to not burn up
the XBee with a too high voltage input. The diodes D4 and D5 are used to drop the
batteries voltage from 4 volts to a rough 3.3 volts. They are in opposing direction to
allow for the battery to be charged when the 5 volt power supply is connected as
depicted in fig 7.
3D Printed Housing
The components used for the model and housing of the Streetlights were all 3D
printed using PLA filament. Each part was designed around the 3D printer’s max print
dimensions. The max dimensions for the 3D printer used is 130 mm x 96 mm x 139
mm. The following parts is a list of all the parts designed and printed to complete the
project. Each STL file will be uploaded to the team’s website so that if anyone needs
to modify or use the files will have access in the future.
Main Part 87 x 57 x 127 (mm)
Stand Part 20 x 20 x 127 (mm)
After each of the parts were printed they were all glued together using Loctite Super
Glue.
1.
Setup/Operation
The only hardware step is plugging the main power block into a wall which will
power the UI System. The User Interface software for the project was written in
Python and can be run using Python 3 or higher. However the initial setup of the
XBees requires a few settings to be configured in the X-CTU program as discussed
earlier before the Python code can be ran.
XBee with Explorer
For Each Streetlight XBee:
Open X-CTU with the XBee plugged into the computer through the USB Explorer.
Click the top left Search glass and click “next” and “finish.” The Streetlight XBees
are now ready to be configured. Adjust the following categories for each Streetlight:
CH Channel: C
ID PAN ID: 17
16-bit address: First Streetlight=FFFC, Second Streetlight=FFFD, Third
Streetlight=FFFF
Scan Channels: 1FFE
Sample Rate: 3E8
D4: DI [3]
D2: DI [3]
To setup the Commander XBee in API mode (XBee that connects to the UI)
CH Channel: C
ID PAN ID: 17
MY 16-bit Address: 0
CE Coordinator Enable: Coordinator [1]
SC Scan Channels: 1FFE
AP API Enable: API enabled [1]
D4 DIO4: Disabled [0]
D2 DIO2: Disabled [0]
CT AT: 64
GT Guard Times: 3E8
CC Command Character: 2B
Open the Program
Once the Beaglebone is connected by HDMI to the screen and through the serial
UART1 pins to the XBee, it can be turned on. After a few seconds it will auto boot to
the OS desktop, from there click the SSL User Interface folder and open
“user_interface.py” in IDLE for Python 3
Press F5 to run the program once it’s open in IDLE.
Parts of the Program
There are three separate functions in “user_interface.py.” Each function can be
accessed from the main menu and perform the different tasks our project set out to
perform.
Main Menu
The program loads directly in to the main menu, from here you have three options,
each one leading to a different function.
The three options are the following:
1. Receive Signals from Network and Save to Packet List
2. Analyze Packet List and Display Results
3. View Incoming Packets in Real Time
Type a number 1-3 and press enter to select your choice. If an invalid choice is picked
the program will re-load the menu.
Receive Signals from Network and Save to
Packet List
From the main menu typing “1” and pressing enter will start this process. Currently it
is set to receive and document 30 packets. With three XBee devices in the network
and each one transmitting once per second, this function should take 10 seconds to
run. Once it has finished it will print “done…” and tell you to press enter to continue.
Pressing “enter” will take you back to the main menu. After running this function a
text document will have been created called “packetList.txt.” Running the function
again will overwrite this document with the new one.
Reading Packet File and Displaying the Results
From the main menu, typing “2” and pressing enter will start this process. Assuming
you have a saved packetList.txt (Created by pressing “1” at main menu) this function
will run. After starting the function, the program will automatically read the
“packetList.txt” and display the status of the lights.
The output can display two errors:

Replace Light

Lost Power
The Replace Light error appears if the light has blown its bulb or LED, replacing it
will fix the problem. Lost power appears of the light has completely lost power. In
this case the XBee device is running off of battery backup. Re-powering the light will
fix this.
If the light is currently running properly it will not appear in the list created by this
function (this could be changed by un-commenting out a few lines of code)
Once finished reading the data, press “enter” to return to the main menu.
View Incoming Packets in Real-Time
From the main menu typing “3” and pressing “enter” will start this process. The
purpose of this function is mostly for diagnosing issues. Running it will display 10
packets, as the system receives them. This function is used to test of the system is set
up and receiving packets properly before running other functions. Once it is finished
press enter to return to the main menu.
Python Code
The entire system Python code is represented below. The code takes in data packets
generated by each XBee for about 20 seconds (Option 1). Once this task finishes, the
packets are analyzed by their hex values and the address which corresponds to what
color streetlight the outage occurs at, and what pin is high or low representing which
type of outage has occurred is recorded to the User (Option 2). Option 3 is simple to
view the packets in real time for debugging purposes.
#Tucker Russ - Safebright System Code
#8/3/2016
#IMPORTANT=============================================================
#with open("test.txt","wt") as out_file:
# out_file.write("testing") with open("packetList.txt","rt") as
#in_file:
# text = in_file.readline() text2 = in_file.readline() text3 =
# in_file.readline()
#print(text) print(text2) print(text3) CODE
#START===================================================================
import Adafruit_BBIO.UART as UART
UART.setup("UART1")
import serial
#from xbee import ZigBee
import time
#FUNCTION FOR READING PACKET FILE AND DISPLAYING
#RESULTS==================================================================
def print_results():
#VARIABLES===========================================
counter = 0
in_list = 0
lights_in_mesh = 3
need_fixing_address = [];
need_fixing_error = [];
#OPEN PREVIOUSLY SAVED PACKET
#LIST==========================================================
in_file = open("packetList.txt","r")
for line in in_file:
text = line
#print(text)
#CHECKS FOR NON-HIGH
#PINS==========================================================
if text.find("\\x14\\x00\\x10") == -1:
#print()
pass
else:
in_list = 1
#print("X needs a light replacement")
if text.find("\\x14\\x00\\x00") == -1:
#print()
pass
else:
in_list = 2
#print("X has lost power")
#SAVES ADDRESS TO
#VARIABLE=====================================================
if in_list == 1 or in_list == 2:
if text.find("x83\\xff\\xfd") == -1:
#print()
pass
else:
light_address = "Green Light"
#print(light_address)
if text.find("x83\\xff\\xfb") == -1:
#print()
pass
else:
light_address = "Red Light"
#print(light_address)
if text.find("x83\\xff\\xfc") == -1:
#print()
pass
else:
light_address = "Blue Light"
#print(light_address)
#FILL OUT
#LISTS=======================================================
#if in_list == 1:
# print("%s needs a light replacement" % light_address) if
#in_list == 2:
# print("%s has lost power" % light_address)
if in_list == 1:
#print("%s needs a light replacement" % light_address)
if light_address not in need_fixing_address:
need_fixing_address.append(light_address)
need_fixing_error.append("Replace Light")
if in_list == 2:
#print("%s has lost power" % light_address)
if light_address not in need_fixing_address:
need_fixing_address.append(light_address)
need_fixing_error.append("Lost Power")
#RESET BEFORE
#RE-LOOPING======================================================
print("\n")
print("\n")
in_list = 0
#PRINT
#LISTS==========================================================
#print(need_fixing_address) print(need_fixing_error)
print_count = len(need_fixing_address) - 1
print("\t |\t Packet List Analysis Results \t\t |")
print("\t |\t Address \t | \t Problem\t |")
print("\t---------------------------------------------------")
while print_count >= 0:
#print(need_fixing_address[print_count])
#print(need_fixing_error[print_count])
print("\t |\t %s \t | \t %s\t |"
%(need_fixing_address[print_count],need_fixing_error[print_count]))
print_count = print_count - 1
#FUNCTION FOR RECEIVING PACKETS FROM NETWORK AND STORING THEM IN A
#LIST==========================================================
def packs_to_file():
ser = serial.Serial('/dev/ttyO1' , 9600)
ser.close()
ser.open()
var = 0
f = open('packetList.txt','w')
while var<30 :
data = ser.read(14)
f.write(str(data))
f.write('\n')
var = var + 1
f.close()
#FUNCTION FOR VIEWING PACKETS FROM NETWORK BUT NOT STORING
#THEM==========================================================
def view_packets():
ser = serial.Serial ('/dev/ttyO1' , 9600)
#ser.baudrate = 9600
var = 0
#count_packs = input("How many packets would you like to view? : ")
while(var < 10):
data = ser.read(14)
print(data)
var = var + 1
ser.close()
#START
#PROGRAM===============================================================
while 1:
print("User Interface v0.9:\tSmart Street Light - Proof of Concept")
print("\n")
print("\t Please select what you would like to do:")
print("\t \t [1] Receive Signals from Network and Save to Packet List")
print("\t \t [2] Analyze Packet List and Display Results")
print("\t \t [3] View Incoming Packets in Real Time")
print("\n")
user_input = raw_input("Choice: ")
if user_input == "1":
packs_to_file()
print("Done...")
if user_input == "2":
print_results()
if user_input == "3":
view_packets()
print("\n")
raw_input("Press Enter to Return to Main Menu")
skip_line = 0
while skip_line < 30:
skip_line = skip_line +1
print("\n")
Parts List
4 XBee Series 1 Communicators
3 XBee Breakout Boards
1 Pin Breadboard
3 Solderable Breadboards
18 Voltage Diodes
6 Toggle Swithces
6 24Ohm Resistors
3 LED 5050 Chip
3 5V DC Cell Phone Charger
3 3.7v Lithium Ion Battery
Various Cables
3D Printer PLA Filament
10” Adafruit LCD Screen
Beaglebone
HDMI Cable
USB Power Cables
RII Keyboard/Touchpad
Safebright Demo Videos
Part 1: https://youtu.be/8fOYRDUkVSI
Part 2: https://youtu.be/Ecw6KhakQXk