Download Bike Buddy

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

Josephson voltage standard wikipedia , lookup

Electric battery wikipedia , lookup

Radio transmitter design wikipedia , lookup

UniPro protocol stack wikipedia , lookup

Transistor–transistor logic wikipedia , lookup

LCD television wikipedia , lookup

Audio power wikipedia , lookup

Ohm's law wikipedia , lookup

Integrating ADC wikipedia , lookup

Valve RF amplifier wikipedia , lookup

CMOS wikipedia , lookup

Operational amplifier wikipedia , lookup

Current source wikipedia , lookup

Resistive opto-isolator wikipedia , lookup

Schmitt trigger wikipedia , lookup

Battery charger wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Power MOSFET wikipedia , lookup

Surge protector wikipedia , lookup

Current mirror wikipedia , lookup

Voltage regulator wikipedia , lookup

Power electronics wikipedia , lookup

Switched-mode power supply wikipedia , lookup

Opto-isolator wikipedia , lookup

Rectiverter wikipedia , lookup

Transcript
Bike Buddy
Group 15
Ari Nacius
Nowook Park
Ethan Pemble
Nick Quinlan
Sponsored By:
Progress Energy
Introduction
 Bike Buddy uses a portable AC
generator to harness power
from pedaling.
 It attaches to the bicycle and
displays riding information.




Speed (mph) and direction
Lat./Long. coordinates
Ambient temperature
Power generated by pedaling
(Watts)
 It also supplies power to USB
devices.
Speed: 18 MPH
Dir:28.53˚N,-81.20 ˚W
T:85 ˚F
P=4.2W
[picture]
Goals & Motivation
 Current portable bicycle generators are
primarily used to power headlights.
 Our goal is to expand on possible
applications of this alternative energy source
by providing additional features to the bike
rider.
 Provide accurate data to the user while
efficiently powering all systems with the AC
generator.
Power Flow Diagram
Power
System
DC converter
Pedal the bike
AC generator
Battery
charger
Battery switcher
6v regulator
5v regulator
3.3v regulator
Display
System
LCD
USB
µC
GPS
Bike Buddy
Power System
Specifications & Requirements
Power
Peripheral
Operating voltage
Expected maximum
current draw
Microcontroller
3.3v
19 mA
62.7 mW
LCD
6v
220 mA
1320 mW
GPS
3.3v
70 mA
231 mW
USB port
5v
500 mA
2500 mW
Total Power
Power requirement
4.12 W
Building the Generator
 Initially we wanted to design our
own custom generator.
 Instead of spending time on
designing a generator we decided
to concentrate on the capabilities
of the LCD and sensing functions.
 Because it was vital to provide
constant power for the rest of the
project to work, we thought it best
to purchase one instead.
Example of a home-made electric generator
Choosing a Generator
Pros:
• Less energy loss to friction
•Sleek design
Cons:
•More expensive
•Custom Wheel Needed
•Low Power Output
Voltage
(volts)
Current
(milliamps)
Power
(watts)
Cost
(USD)
Current
Source
6V
400mA
2.4W
$63.70
AC
Pros:
•Higher Power Output
•Cheap
Cons:
•Energy Loss in wet or muddy
conditions
•Produces
buzzingPower
noise Cost
Voltage
Current
(V)
(mA)
(W)
(USD)
Current
Source
12V
500mA
6W
$16.99
AC
Power Supply
AC/DC conversion

No need for a step-up or step-down
transformer.

Full Bridge rectifier using 4 schottky
diodes for low voltage drops.

A 50V 2200 uF electrolytic capacitor is
used to minimize the ripple before
regulation.

A voltage regulator (LM317) regulates
the voltage to a constant 10V.
Formulas to find the average DC
Voltage from the generator
,
When Vrms = 30V,
Vdc = (30V x 1.414)/3.14 = 13.5V
Battery Characteristics
Battery Characteristics
Lead Acid
Nickel Cadmium
Nickel Metal Hydride
Lithium Ion
30-40
40-60
30-80
100-160
60-75
50-150
140-300
250-360
180
150
250-1000
250-340
50-92%
70-90%
66%
80-90%
—
2.75
2.8 - 5
3-20%
10%
30%
8% (21°C)
Cycle Durability
500-800
2,000
500-1,000
1,200
Nominal Cell
Voltage
2.105V
1.24V
1.2V
3.6V
Nominal Capacity
7200 mAh
900 mAh
700 mAh
4800 mAh
Size
151x98x98mm
73x29x52mm
51x48x22mm
127x80x43mm
Weight
3940g
210g
135g
678g
Energy/Weight
(Wh/kg)
Energy/Size
(Wh/L)
Power/Weight
(W/kg)
Charge/Discharge
Efficiency
Energy/Price
(Wh/USD)
Self-discharge
Rate (per mo.)
Specifications & Requirements
Lithium-Ion BatteryPack (2 Cell)
 Capacity: 1400mAh
 Voltage: 7.4 V (8.4 V pk)
 Dimensions: 51mm x 38.1mm x 19mm
 Weight: 2.5 oz
 Maximum Charge Current: 1C or 1.4A
 Maximum Current Draw: 0.87 A
Li-Ion Battery Charger
Charger Comparison Table
ADP3810
(Analog Devices)
MAX1758
(Maxim)
MCP73842
(Microchip)
Input Voltage
-0.4V to 18V
-0.3V to 30V
-0.3V - 12V
Max Charge
Current
1.2A
1.5A
2A
Operational Temp
40C to +85C
40C to +85C
40C to +85C
Maximum Power
Dissipation
500mW
762mW
120mW
Battery Temp
monitoring
No
No
Yes
Packaging
SO-8
SSOP-28
MSOP-8
Li-Ion Battery Charger

MCP73842 manufactured by Microchip to
charge an 8.4V Li-Ion battery.

Programmable Charge Current.

Programmable Safety Charge Timers.

Preconditioning of Deeply Depleted Cells.

Automatic End-of-Charge Control.

Continuous Cell Temperature monitoring

Automatic power-down when input power is
removed to prevent battery discharge.
Ctimer = 0.033uF
Tprecon
= (Ctimer/0.1uF) X 1 hr
= 19.8 mns
Tfast-charge = (Ctimer/0.1uF) X 1.5 hrs = 29.7 mns
Tterm
= (Ctimer/0.1uF) X 3 hrs = 59.4 mns
Typical Charge Profile
Charge Circuit Flow Diagram
Li-Ion Battery Charger (cont’d)
For a maximum charge current of 2A,
RSENSE is calculated using the formula
in the datasheet.
RSENSE = 120mV / 2A = 60m

The charger turns off when the battery
reaches a temperature limits of 10 F
and 80 F.

Those temperature limits are set using
two resistors Rt1 and Rt2
Rt1 = (2 x 10 x 100)/(100 - 10) = 22 Ohms
Rt2 = (2 x 10 x 100)/(100 - 3 x 10) = 28.57 Ohms
Practical values:
Rt1 = 22.22 Ohms
Rt2 = 29.00 Ohms
*maufacturer-recommended design
configurationation.
Battery Switcher

2 comparators to monitor
and compare the battery
voltage levels with a
reference voltage of 3.5V.

6 p-channel mosfets used
to switch the batteries
when the source battery
reaches 3.5V.

A zener diode is used to
keep the reference voltage
at a constant 3.5V.

The 100uF capacitor is to
ensure that the output
doesn’t change during the
switch.
Battery Switcher
 One battery powers the unit
while the other is being
charged.
 Switch happens when the
battery powering the unit
reaches 3.5V.
 3.5V is the minimum input
voltage range of switching
regulators that power the
subsystems.
 The power source switch does
not affect the operation of the
unit.
Switcher Profile
Switching Regulators
Vref=1.5 V, 10kΩ ≤R1≤ 500kΩ
R2=R1*(Vout/Vref-1)
For Vout=6V: R1=10kΩ,
R2=30kΩ
Switching Regulators
The MAX608 low-voltage step-up controller operates
from a 1.8V to 16.5V input voltage range.
 Pulse-frequency-modulation (PFM) control provides high
efficiency at heavy loads, while using only 85μA (typical) when
operating with no load.
In addition, a logic-controlled shutdown mode reduces supply
current to 2μA typical. The output voltage is factory-set at 5V or
can be adjusted from 3V to 16.5V with an external voltage divider.
The MAX608 operates in “bootstrapped” mode only (with the
chip supply, OUT, connected to the DC-DC output). The two
bootstrap capacitors and are employed on both sides of inductor to
provide gate voltage to high side input switch through high side
driver in any mode of operation. This allows the regulator to work
in all three modes of operation without different external
components or configurations depending on the mode.
Bike Buddy
Power Sensor
Current Sensor

The ACS756 current sensor needs
a single +3 to+5V supply.

Ultra-low power loss: 130uOhm
internal resistance.

13kVRMS isolation voltage
between terminals 4/5 and pins
1/2/3.

Output voltage proportional to
AC and DC current.

20mV/A output sensitivity.

Nearly Zero magnetic hysteresis
Analog-to-Digital Converter
The ADC pins have a voltage range of 0V to
5V. But since the internal reference voltage
is 2.56V, our input voltage must not reach
that level.

0.0025 = (1/10)(R2/(R2+R1))

1/40 = R2/(R1+R2)

We use a voltage divider to prevent the
attempted maximum voltage from the
generator from reaching 2.56V on the ADC
pins.

R1 = 39K, R2 = 1K

Voltage interval = 2.56V / 1023 = 0.0025V

At every 2.5mV increment, a binary data is
recorded and stored in a data register.

Since we want the recorded voltage to be
accurate to 1/10 of a volt, we select resistor
values that will increment the stored binary
data at every 1/10 of a volt.

Analog-to-Digital Converter (cont’d)

The ADC is used to measure the
power generated by the generator by
monitoring the voltage and current.

The current sensor output is connected
to a similar voltage divider as the one
on the right for the battery.

Since we don’t want to drain the
batteries, we use a to isolate the
batteries from the voltage divider.
Bike Buddy
Display System
Display System Goals
 Small and power
efficient
 Peripheral sensors to
provide information to
the rider:
Lat: 28.60265
Lon: -81.23185
NE
12:37 PM
67 °F
Generating
3.7 Watts
6.73 MPH
 Speed and direction
 Power generated
µC
 Global position
 Ambient temperature
 Time of day
GPS
Power sensor
Liquid Crystal Display
 Serial Graphic LCD from
sparkfun
 Provides simple 1-wire
serial interface with builtin commands and
character display.
 128x64 pixel space
 Software-scalable
backlighting for
indoor/outdoor use
 Operates at 6v, average
current draw ~125 mA
(with full backlighting)
GPS Receiver: LS20031
 The LS20031 GPS unit
has an embedded
antenna and simple TTL
serial interface.
 Built-in battery stores
satellite positions for
rapid startup.
 3.3v @ 41 mA
Microcontroller
Atmel ATmega128 L
Input/Output
53 pins
Memory
128KB FLASH
4KB EEPROM
4KB internal SRAM
Analog-to-Digital
10 bit, 8 channel
Peripheral Interface
2 USART, TWI, SPI
Clock Speed
Up to 8 MHz
Operating Voltage
2.7 – 5.5 v
Expected Active Current
~20 mA
Development Board: STK-300
 RS-232 port for USART
communication.
 Simple USB programmer
for quick prototyping.
 Provides 8 buttons and
LEDs for testing.
 External 8 MHz crystal
provided for source clock.
 Includes C compiler
(WinAVR) and AVR Studio
4 development
environment.
Software Overview
Power Switch
ON
Initialize Serial
Devices
Retrieve Sensor Data
Retrieve Power
Sensor Data
(ATD)
Retrieve GPS Data
(USART1)
Retrieve
Temperature Data
(TWI)
Format numbers for display
Update Display
(USART0)
Stand-by
Timer
overflow?
ATmega128 Timer
The sensor update loop is driven by a timer,
and executed every 300ms. The screen will
update roughly 3 times per second.
 Timer1: 16-bit timer
 System clock rate: 7.3728 MHz
 Prescaler: divide-by-1024
 Tic: 7.2 kHz
 Overflow: 9.1 ms
 Desired period: 300ms or 2730 overflows
USART on the ATmega128L
USART is dependent on the internal system clock and is
highly sensitive. To reduce data error rates, an external
system clock rated at 7.3728 MHz is chosen.
Both devices (the LCD and the GPS receiver) are
configured to transmit at 9600 bps with 8 data bits, 1 stop
bit, no parity bit.
Liquid Crystal Display
C1 = C2 = 15 nF
GPS Receiver
Serial Device
USART0
Serial Device
USART1
Transmit pin
PE1 (#3)
Transmit pin
PD3 (#28)
Receive pin
PE0 (unused)
Receive pin
PD2 (#27)
Baud rate
9600 bps
Baud rate
9600 bps
Frame
Structure
8N1
Frame
Structure
8N1
LCD Commands
Wrapper functions
int lcd_clearScreen()
int lcd_setBacklight(int)
int
int
int
int
int
int
int
lcd_setPixel(int,int)
lcd_setX(int)
lcd_setY(int)
lcd_drawLine(int,int,int,int)
lcd_drawCircle(int,int,int)
lcd_drawBox(int,int,int,int)
lcd_erase(int,int,int,int)
Native Commands
Command
Byte
Argument
Description
Clear Screen
0x00
—
Clears all written pixels.
Reverse Mode
0x12
—
Green-on-black pixel display.
Splash Screen
0x13
—
Toggles sparkfun logo at boot.
Set Backlight
0x02
0:100d
Set Baud Rate
0x07
“1:6”
The number is decimal.
Retained during power cycling.
Drawing
Command
Byte
Argument
Description
Set X Coordinate
0x18
0:127d
Moves cursor for text generator.
Set Y Coordinate
0x19
0:63d
Moves cursor for text generator.
Set/Reset Pixel
0x10
x, y, 0:1d
0: set (x,y) pixel, 1: reset (x,y) pixel
Draw Line
0x02
x1, y1, x2, y2, 0:1d
(x1,y1) to (x2,y2), 0: draw, 1: erase
Draw Circle
0x07
x, y, r, 0:1d
Draw Box
0x0F
x1, y1, x2, y2, 0:1d
Erase Block
0x05
x1, y1, x2, y2
(x,y) center, r: radius, 0: draw, 1: erase
(x1,y1) to (x2,y2), 0: draw, 1: erase
Entire box is erased.
Parsing GPS Information
 The only NMEA record used in the design is the
Recommended Minimum Specific GNSS Data (RMC),
which provides UTC time, date, latitude, longitude,
speed over ground, and course over ground.
$GPRMC,053740.000,A,2503.6319,N,12136.0099,E,2.69,79.65,100106,,,A*53
Name
Example
Message ID
$GPRMC
RMC protocol header
UTC Time
053740.000
hhmmss.sss
Status
A
A = data valid or V=data not valid
Latitude
2503.6319
ddmm.mmmm
N/S Indicator
N
N=north or S=south
Longitude
12136.0099
dddmm.mmmm
E/W Indicator
E
E=east or W=west
Speed over ground
2.69
Knots
Course over ground
79.65
Degrees
Date
100106
Magnetic variation
Description
True
ddmmyy
Degrees
Variation sense
E=east or W=west (not shown)
Mode
A
Checksum
*53
<CR><LF>
Units
A=autonomous, D=DGPS, E=DR
End of message termination
Bike Buddy
Temperature Sensor
Parameter
Symbol
Condition
Min
Typ
Max
Units
Supply Voltage
VDD
Local Power
3.0
-
5.5
V
Parasite Power
3.0
Pull-up Supply
Voltage
VPU
5.5
-
Local Power
3.0
V
VDD
Sink Current
IL
VI/O =0.4V
4.0
-
-
mA
Standby
Current
IDDS
-
-
750
1000
nA
Active Current
IDD
VDD=5V
-
1
1.5
mA
DQ Input
Current
IDQ
-
-
5
-
µA
DS1625
•Data is read from / written via a 2-wire serial
interface
(open drain I / O lines)
•Temperature measurements require no
external components
•Measures Temperatures from -55°C to
+125°C (-67°F to +257°F)
• Converts temperature to digital word in 500
ms
•Temperature is read as a 9-bit value (two
byte transfer)
Parameter
Supply
Voltage
Symbol
VDD
Min
4.5
Typ
5.0
Max
5.5
Units
V
DS1625
Pin
1
SD
A
Data input/output pin for 2-wire serial communication port
Pin
2
SC
L
Clock input/output pin for 2-wire serial communication port
Pin
3
Tout
Thermostat output. Active when temperature exceeds TH;
will reset when temperature falls below TL
Pin
4
GN
D
Ground pin
Pin
5
A2
Address input pin
Pin
6
A1
Address input pin
Pin
7
A0
Address input pin
Pin
8
VDD
Supply voltage 5V input power pin
DS1625
MSB
1
1
1
0
0
LSB
1
1
Temperature is
represented in the
DS1625 in terms of a
0.5°C LSB.
Not Using, Remains 0
1
0
0
0
0
0
0
0
0
= -25°C
Temperature
Digital Output
(Binary)
Digital output (Hex)
+125°C
01111101 00000000
7B00h
+25°C
00011001 00000000
1900h
+1/2°C
00000000 10000000
0080h
+0°C
00000000 00000000
007Fh
-1/2°C
11111111 10000000
FF80h
-25°C
11100111 00000000
E700h
-55°C
11001001 00000000
C900h
Two Wire Interface (TWI)

A popular serial peripheral interface bus

TWI stands for Two Wire Interface and for most parts this bus is identical
to I²C.

The name TWI was introduced by Atmel and other companies to avoid
conflicts with trademark issues related to I²C.

-More flexible than SPI (Serial Peripheral Interface )

-Master and slave modes supported

-7-bit slave address

-Bidirectional, open-drain bus (device pulls down, resistors pull up)

-Two wires, SCL, (clock) and SDA (data)
Typical TWI bus configuration
Two Wire Interface
 A TWI transmission consists of
 Start condition
 An address packet consisting of
 -Read/Write indication and
 -Slave acknowledge, (SLA+RW)
 One or more data packets
 Stop condition
 A Start condition initiates a transmission by a master.
 Between Start and Stop conditions, the bus is busy and no other masters
should try to initiate a transfer.
 A Start condition is signaled by a falling edge of SDA while SCL is high.
Two Wire Interface
Address packet

-Address packet is 9 bits long

-MSB first

-Address “000 0000” is reserved for broadcast mode

-7 address bits (driven by master)

-1 read/write control bit (driven by master)

-1 acknowledge bit (driven by addressed slave)
Two Wire Interface
 Data packet
 -All data packets are 9 bits long
 -MSB first
 -One data byte plus an acknowledge
 -During a transfer, Master generates SCL, Receiver acknowledges
 -Acknowledge (ACK): Slave pulls down SDA in the 9th SCL cycle
 -Not Acknowledge (NACK): Slave does not pull down SDA in 9th
cycle
USB
WHY USB?
•USB, became really popular nowadays to connect computer peripherals.
•Not only for Data Source, but Power Source
•A USB controller require to power one unit load, which is around 100mA.
•such as fan, light, charging the batteries of mp3 players and cell phones.
USB Types
Parameter
Requirement
DC voltage, high-power port
4.75V to 5.25V
DC voltage, low-power port
4.75V to 5.25V
Maximum quiescent current (low power,
suspend mode)
500µA
Maximum quiescent current (high power,
suspend mode)
2500µA
Maximum allowable Input capacitance
(load side)
10µF
Minimum required output capacitance
(host side)
120µF ±20%
Maximum allowable inrush charge Into
load
50µC
USB Powering
USB Specs
Pin No.
Signal
Cable
Color
1
+ VCC
Red
2
Data -
White
3
Data +
Green
4
GND
Black
Budget
Product/Part
Vendor/Service
Actual Cost
ATmega128L dev board (STK300)
Kanda.com
$104.00
Serial graphic LCD 128x64
Sparkfun.com
$100.00
Bike generator 12V 6W
Bike World USA
$16.99
LS20031 GPS receiver
Sparkfun.com
$60.00
2x 2-cell Li-Ion Battery packs
Powerizer.com
$40.00
Temperature sensor circuit
Digikey/Mouser
$20.00
USB port (female)
Sparkfun.com
$4.00
Power supply circuit
Digikey/Mouser
$300.00
Battery charger circuit
Digikey/Mouser
$100
Battery switching circuit
Digikey/Mouser
$100
Packaging/Misc. Hardware
Skycraft, …
$200
Extra cost
$300
Total
~$1300
Milestones
Feb. 26
Assemble prototypes
of hardware systems
Mar. 27-28
Build and test
power supply
April 24
reBuild and retest
power supply
Mar. 13-14
Battery circuit built
and tested
Feb
Mar
Feb. 27-28
Successfully
implement USART
devices
Feb. 19
Complete part
acquisition
Apr
Mar. 20-21
Finish
programming
Mar. 10
Complete basic
software control flow
Apr. 3-4
Assemble unit and
attach to bicycle for
final testing
Bike Buddy
Group 15