Sei sulla pagina 1di 22

FINAL REPORT

BY ANKIT DEORA

FIRST
WEEK
WORK
Proposed various sensors we can use for interaction with smart
home gadgets.

VISUAL
BASED
INPUTS :
facial expressions,
hand gestures, body
postures,
eye movements

SENSORS :
passive infrared
sensor(PIR),
capacitive sensor,
proximity
sensor, ping sensor

HUMAN MACHINE
INTERACTION
AUDIO BASED
INPUTS :
human made noise,
sound, speech, laugh,
cry, musical notes,
clap sound, whistle

SENSORS :
Microphones,
clapper, speech
recognition, sensors,
etc.

SENSOR
BASED
INPUTS :
using some other media
like mouse, keyboard,
Remote, joystick, touch
screen phones, pressure
sensors

SENSORS
:

Inductive sensor,
dexterous glove, etc.

SECOND WEEK WORK

STUDIED :

1. Wireless communication and networks in home automation using


RF modules.
2. How to program Attiny MCU using Arduino as ISP programmer.
3. Power consumption differences between Atmega and Attiny
MCUs in different
power modes.
WORK DONE:
1. Proposed to interface Attiny 87 or Attiny 167 with RF modules for
our project.
2. Programmed Attiny MCU on Arduino platform.
3. Tested few sketches like LED blinking, LED dimming, ADC
conversion, etc. using Attiny MCU.

THIRD WEEK WORK

Started working on RF module nRF24L01.

Studied about RF24 module features like : air data rate, current
consumption in different power modes, packet handling, enhanced
shock burst mode, pipe multiCeiver, etc. from the datasheet.
Studied about various functions and parameters that control the RF
modules using software from RF24 library.
Communicated two RF modules by connecting them with two Arduino
UNO boards and tested following codes successfully :
1. led_communication
2. print_joystick_values
3. send_number

LAST WEEK WORK


COMPLETED TWO TASKS
Created a library for mobile nodes.
Measured current consumption in Arduino using
multimeter for different power modes.

NODES IN A WIRELESS
In a wireless network NETWORK
data transmission takes place through
electromagnetic waves. For transmission to be possible
transmitter and receiver nodes must be in range of each other.
When direct transmission is not possible between two nodes
then it takes place by hopping which require intermediate
nodes.
Nodes in a wireless network may be static as well as dynamic
(mobile).
Static Nodes : These nodes remain stationary with respect to
each other and they know the address of other static nodes.
Mobile Nodes : Position of these nodes vary with time. These

OUTPUT POWER CONTROL


IN RF MODULES
Software interfacing of wireless transmission in RF modules
(nrf24L01+) can be done by using RF24 library.
Signals can be send at different power by controlling the PA
level in RF module.
This library allows us to control PA (power amplifier) level in
transmitter mode of RF module by function setPALevel(mode
parameter).
MODE
RF_PWR
RF OUTPUT
CURRENT
PARAMETER

POWER

DRAWN

PA control is done by setting the RF_PWR bits in RF_SETUP


RF24_PA_MIN
00
-18dBm
7.0mA
register.
RF24_PA_LOW
01
-12dBm
7.5mA
RF24_PA_HIGH

10

-6dBm

9.0mA

RF24_PA_MAX

11

0dBm

11.3mA

ABOUT LIBRARY
When a mobile node enters the network, it gets authenticated by the central
controller by making call to authentication().
After it, the mobile node decides it parent by making call to broadcast().
Node replying first to the broadcast message is made parent of the mobile
node, now the mobile node sends message to its destination node via its
parent node.
When the mobile node looses communication with its parent node, it calls
find_parent() in search for a new parent node.
Firstly, send and broadcast functions are called in low power mode, if task is
not completed then high power mode functions may be called.
Messages are sent in the form of a 32 byte buffer named buffer_packet which
contains the source and destination addresses and other information about
the data packet.
Ref : https://drive.google.com/file/d/0BzUNiVUsn1W2cEpTenVhTjlZa0k/edit?usp=sharing

VARIABLES USED
Parent_address

address of the parent node.

Self_node_address

address of the mobile node.

Broadcast_address

address of the broadcasting pipe.

Buffer_packet

pointer to the 32 byte buffer.

Message_count

:
no. of messages sent to a particular
parent node.

Broadcast_msg_type

type of the message to be sent.

These variables are kept private so that functions other than the class cant
modify them.

FUNCTIONS USED
MobileNode()
: Constructor for the class MobileNode, initializes
different addresses, radio, buffer, etc.
Authentication() : Mobile node asks central controller to permit it to be a
part of the wireless network.
Broadcast() : used to send a message in search for a new parent node.
Receive() : reads data from the receiving pipe and returns the bool value
of receipt.
Send() : writes buffer data on writing pipe and returns the bool value of
the task completion.
Putint64() : puts a 64-bit value in the 32-byte buffer at a specific location.
Takeout() : take out a 64-bit value from the 32-byte buffer from a specific
location.

StartRadio() : configures radio and initialize it .


Low_power_broadcast() : send broadcast message using low power mode.
Low_power_send() : send buffer data using low power mode.
setDA() : sets destination address in the buffer packet.
setSA() : sets source address in the buffer packet.
setAmount() : sets length of the message body, varies from 0 to 25.
setMsgType() : sets the type of message like warning, broadcast,
authentication or normal message in the buffer packet.
setCount() : sets the Message_count variable in the buffer packet.
Encrypt() : converts the message in to other form to prevent unauthorized
access.

POWER AND SLEEP MODES IN


MICRO-CONTROLLERS
Power saving is done by sleeping micro-controller for a particular time by
shutting down the various unused modules. Attiny 87/167 support four sleep
modes :
MODE

INACTIVE
MODULES

ACTIVE MODULES

WAKING
SOURCES

IDLE

CPU and flash clock

I/O and ADC clock, SPI,


UART, TIMER, TWI,
watchdog timer and
interrupts

External and
internal interrupts
(WDT and timer
interrupts)

ADC NOISE
REDUCTION
MODE

CPU, flash and I/O


clock

I/O and ADC clock, SPI,


UART, TIMER, TWI,
watchdog timer and
interrupts

External and
internal interrupts
(WDT and timer
interrupts)

All system clocks and Watchdog timer (WDT),


oscillators
twi serial interface and
external interrupts

WDT interrupt and


external interrupt

POWER DOWN

POWER SAVE

CPU, flash, I/O and


ADC clocks

WDT, twi, external


interrupts,

WDT interrupt,
timer interrupts and

SLEEP MODE WE CAN USE


The nRF24L01 modules use SPI protocol for wireless communication.
SPI module requires I/O clock to synchronise communication and only idle
mode have I/O clock activated.
Out of the four modes power down mode is the most energy efficient
mode but only idle mode has the SPI activated, so idle mode can be used
for the wireless communication between RF modules.
Digital pins are active and depending on their set states, some current
will come in to count
In this mode, we can use WDT (watchdog timer) interrupt to awake
system from the idle mode, WDT can keep the MCU in sleep mode for few
milliseconds to few seconds depending upon the prescalar value we set.
When the timer interrupt occurs and if the reset mode is not set, program
start executing from where it left.

WORKING CODE FOR


Link to the code : https:// WDT TIMER
drive.google.com/file/d/0BzUNiVUsn1W2SUJMalNkc2dpVmM/edit?usp=sharing

This code shows how watchdog timer can be used to awake the MCU
from sleep mode.
This code was tested for power down mode on Arduino UNO, Idle
mode can be tested using this code by replacing the parameter
SLEEP_MODE_PWR_DOWN with SLEEP_MODE_IDLE in the function call
set_sleep_mode() .
The MCU enters the sleep mode after the function call do_sleep() .
In this code MCU remains in sleep for 4 seconds and after that, WDT
interrupt wakes up the MCU.
Since the reset mode is not used in this example, after waking up, the

POWER SAVING MODES


IN RF24 LIBRARY

The current consumption can further be reduced by powering down the


RF modules.
RF24 library allows to power down the RF module by using the function
powerDown() for object of the class RF24.
Similarly there is a powerUp() function to exit the power down mode
which also occurs if write() or startListening() is called.
Calling powerDown() lowers the power of RF modules only and not the
MCU i.e. current consumption by the RF modules is lowered only.
To lower the power of MCU, we use sleep modes.
Link to the example in which RF modules are powered down is below :
https://
drive.google.com/file/d/0BzUNiVUsn1W2enNkZlBGRG8xQWs/edit?usp=sharing

CURRENT MEASUREMENT
USING MULTIMETER

Current can be measured by keeping multimeter in series in any circuit


just like an ammeter.
Current drawn by an Arduino board in different sleep modes can be
measured using a multimeter.
I had two Arduino UNO boards, one of the Arduino board (say board A)
draws power from the laptop through the connecting cable and the
other Arduino board (say board B) draws power from the first board by
connecting their Vcc with each other and also the GNDs.
Multimeter can be put in series with the wire joining the Vcc of both
boards and thus current can be measured.
Now Arduino board B can be programmed in different sleep modes and

DIAGRAM FOR CONNECTIONS

CURRENT CONSUMPTIONS
Current consumptions in both boards are different as no boards can be perfectly
identical. If output resistance seen by the supply is different for both boards then the
currents consumed will be different also. This resistance difference may occur due to
minor differences between the structure of various components on the Arduino board.
MODE

CURRENT CONSUMPTION IN
BOARD A

CURRENT CONSUMPTION IN
BOARD B

NORMAL

38-39mA

54-55mA

POWER DOWN

33-34mA

47-48mA

IDLE

35-36mA

49-50mA

*NORMAL MODE +
RF MODULE
CONNECTED

50-52mA

67-69mA

* More info on page


17

CURRENT CONSUMPTION
WHEN WDT IS ACTIVATED IN SLEEP MODE
For measuring current in this mode, I programmed the board B with the below
code.
Link to code : https://
drive.google.com/file/d/0BzUNiVUsn1W2SUJMalNkc2dpVmM/edit?usp=sharing

Now since this program has WDT timer set for 4 seconds, MCU does not remain
in the sleep mode always, it wakes up after every 4 seconds.
Thus current consumption is different during the sleep mode and the wakeup
mode, thus we dont see a constant reading on the multimeter, instead we
observe a periodic reading.
Current remains low for 4 seconds and then there is a sudden rise for a very little
WDTdue
ACTIVATED
MODE
DURING SLEEP
WHILE AWAKE
time
to wakeup.
CURRENT
CONSUMED
Readings
I got
:

47-48mA

54-55mA

CURRENT MEASUREMENT
WITH RF MODULE CONNECTED
Current was measured by connecting RF modules on both boards shown
in figure on page 14.
Since RF modules draw a current of 11-13mA in active mode, current
consumption for board B was observed around 67-70mA.
For debugging purpose, serial monitor was used which showed whether
response was received by the other RF module or not.
Two or three times there was some errors obtained in serial monitor.
error 1 : other RF module received wrong response ( screenshot1)
error 2 : communication failed, response time out (screenshot2 )
Link to the code used in this example : https://
drive.google.com/file/d/0BzUNiVUsn1W2d01QWnVTaWYyZ2s/edit?usp=sha
ring

DISCUSSION
Current measured in different sleep modes on Arduino boards was quite high
in the range of 30-60mA because Arduino boards have a lot more components
other than pins and atmega MCU like voltage regulators, IC for serial
communication with PC, RX/TX leds, etc. which consumes a good amount of
power resulting in high current consumption.
Normally the current consumption in MCUs (atmega or Attiny) is in the range
of 1-5mA in active modes and RF modules consume 11-12mA in active mode
so together they will consume around 10-15mA if measured by powering VCC
and GND of the MCU.
Two RF modules takes a time range of around 20-50 milliseconds for one
complete cycle of data communication, so if we set the IDLE mode in MCU
using WDT timer for 100 milliseconds, then this might reduce the power
consumption by 40-50% which means almost doubling the battery life.

THANK YOU

Potrebbero piacerti anche