With a 20ms sample rate your sound must be just barely sub-audible at 25Hz...
Anyway, the Oscope example (used to) do a buffering scheme to send a single message with 10 or so samples. That would reduce the message overhead significantly. Otherwise you are just going to run into bandwidth issues. Using another Timer to send data at a lower rate will just eventually under-run your sample rate. MS Jacob Cox wrote: > Hello, > > We have managed to program our Tmote Invents to pass sound back to our > sink as part of a multi-hop network. We incorporated pieces of the Delta > and Oscilloscope code to do it. The problem we are having now involves > slowing down the sending of data so that we can reduce the congestion > we're having. Right now, everytime are clock fires, we record the ADC > data from the Mic and send it. We would like to keep the Sound Data > rate, but we want to transmit less offten. I'm thinking we need to > utilize a seperate timer to control our send, but I think we also need > to utilize memory to hold our Samples until we can send them. > > Our code follows. We'd appreciate any solutions for adding these memory > and sending requirements. > > /* > * Copyright (c) 2006 Moteiv Corporation > * All rights reserved. > * > * This file is distributed under the terms in the attached > MOTEIV-LICENSE > * file. If you do not find these files, copies can be found at > * http://www.moteiv.com/MOTEIV-LICENSE.txt and by emailing > [email protected] <mailto:[email protected]>. > */ > #include "Delta.h" > /** > * The Delta application is an example of a multihop data collection > * system. By installing Delta on Moteiv's motes, the devices will > * sample their internal temperature sensor and report readings using > * a Multihop/Mesh topology. Compile and install using: > * <p> > * <tt>make tmote</tt><br> > * <tt>make tmote install</tt> > * <p> > * Delta supports Tmote Sky and Tmote Invent. Compile for Tmote Invent > * using: > * <p> > * <tt>make tmoteinvent</tt><br> > * <tt>make tmoteinvent install</tt> > * <p> > * Delta also supports low power operation using Moteiv's low power > * synchronization software. The default duty cycle of Moteiv's low > * power networks is 5%. To compile Delta with low power duty > * cycling, use the following command: > * <p> > * <tt>make tmote lowpower</tt> > * <p> > * The duty cycle for Delta is configurable at compile time. By > * specifying a value to the lowpower option, you can change the duty > * cycle. For example, to specify a duty cycle of 2%, compile with: > * <p> > * <tt>make tmote lowpower,2</tt> > * <p> > * After installing Delta on Moteiv motes, you have two options for the > * base station mote. > * <p> > * <b>Option 1:</b> > * <p> > * The base station is installed with address 0 using the following command: > * <p> > * <tt>make tmote reinstall,0</tt> > * <p> > * Any node with address 0 automatically configures itself to be the > * base station. You can run any application to acquire data from > * node 0, such as Trawler (described below) or Listen (java > * net.tinyos.tools.Listen). > * <p> > * <b>Option 2:</b> > * <p> > * Any node with USB may be used as the base station, but it must > * first be informed by the PC that it is a base station. This > * procedure is completed by the Trawler java application. If your > * mote is connected on communications port COM5, start the Trawler > * application with the command: > * <p> > * <tt>motecom=ser...@com5:tmote java com.moteiv.trawler.Trawler</tt> > * <p> > * Trawler will start, communicate with the mote connected to the PC, > * and start building the Multihop network. > * <p> > * <b>NOTE:</b> For nodes with addresses that are not 0, they will cease > * acting as the base station as soon as the Trawler application is > * closed or terminated. > * > * @author Joe Polastre, Moteiv Corporation <[email protected] > <mailto:[email protected]>> > */ > configuration Delta { > } > implementation { > components Main; > components MultiHop > , DeltaM as Impl > , TimerC > , LedsC > , new MainControlC() as MainMicC > , MicDriverC > , GenericComm as Comm > ; > components DelugeC; > > Main.StdControl -> MultiHop; > Main.StdControl -> TimerC; > MainMicC.SplitControl -> MicDriverC; > Main.StdControl -> Impl; > Main.StdControl -> Comm; > // periodically sample a sensor > Impl.Timer -> TimerC.Timer[unique("Timer")]; > Impl.TimerBlink -> TimerC.Timer[unique("Timer")]; > Impl.Mic -> MicDriverC; > // send data messages > Impl.SendDeltaMsg -> MultiHop.Send[AM_DELTAMSG]; > // monitor traffic being forwarded > Impl.SnoopDeltaMsg -> MultiHop.Intercept[AM_DELTAMSG]; > // get statistics about current operation > Impl.RouteControl -> MultiHop; > Impl.RouteStatistics -> MultiHop; > // pretty LEDs > Impl.Leds -> LedsC; > } > > -------------------------------------------------------------------------------------------------------- > /* > * Copyright (c) 2006 Moteiv Corporation > * All rights reserved. > * > * This file is distributed under the terms in the attached > MOTEIV-LICENSE > * file. If you do not find these files, copies can be found at > * http://www.moteiv.com/MOTEIV-LICENSE.txt and by emailing > [email protected] <mailto:[email protected]>. > */ > #include "Delta.h" > #include "circularQueue.h" > /** > * Implementation of the Delta application as described by the Delta > * configuration. > * > * @author Joe Polastre, Moteiv Corporation <[email protected] > <mailto:[email protected]>> > */ > module DeltaM { > provides { > interface StdControl; > } > uses { > interface Send as SendDeltaMsg; > interface Intercept as SnoopDeltaMsg; > interface RouteControl; > interface RouteStatistics; > interface ADC as Mic; > interface Timer; > interface Timer as TimerBlink; > interface Leds; > } > } > implementation { > /************************* VARIABLES *******************************/ > uint16_t m_adc; > uint32_t m_seqno; > TOS_Msg msg[DELTA_QUEUE_SIZE]; > CircularQueue_t queue; > /************************* HELPER FUNCTIONS ************************/ > task void sendData() { > uint16_t _length; > int i; > uint16_t neighbors[MHOP_PARENT_SIZE]; > uint16_t quality[MHOP_PARENT_SIZE]; > > if (cqueue_pushBack( &queue ) == SUCCESS) { > DeltaMsg* dmsg = (DeltaMsg*)call > SendDeltaMsg.getBuffer(&msg[queue.back], &_length); > atomic dmsg->reading = m_adc; > dmsg->parent = call RouteControl.getParent(); > call RouteStatistics.getNeighbors(neighbors, MHOP_PARENT_SIZE); > call RouteStatistics.getNeighborQuality(quality, MHOP_PARENT_SIZE); > for (i = 0; i < MHOP_PARENT_SIZE; i++) { > dmsg->neighbors[i] = neighbors[i]; > dmsg->quality[i] = quality[i]; > } > dmsg->neighborsize = MHOP_PARENT_SIZE; > dmsg->retransmissions = call RouteStatistics.getRetransmissions(); > dmsg->seqno = m_seqno; > if (call SendDeltaMsg.send( &msg[queue.back], sizeof(DeltaMsg) ) > == SUCCESS) { > call Leds.redOn(); > } > else { > // remove from queue > cqueue_popBack( &queue ); > } > } > // always increase seqno. gives a better idea of how many packets > // really have been dropped > m_seqno++; > } > void blinkBlue() { > call Leds.yellowOn(); > call TimerBlink.start(TIMER_ONE_SHOT, 20); > } > /************************* STD CONTROL *****************************/ > command result_t StdControl.init() { > cqueue_init( &queue, DELTA_QUEUE_SIZE ); > return SUCCESS; > } > command result_t StdControl.start() { > call Timer.start( TIMER_REPEAT, DELTA_TIME ); > return SUCCESS; > } > command result_t StdControl.stop() { > return SUCCESS; > } > /************************* TIMER ***********************************/ > event result_t Timer.fired() { > call Mic.getData(); > return SUCCESS; > } > event result_t TimerBlink.fired() { > call Leds.yellowOff(); > return SUCCESS; > } > /************************* ADC *************************************/ > async event result_t Mic.dataReady(uint16_t data) { > m_adc = data; > post sendData(); > return SUCCESS; > } > /************************* SEND ************************************/ > event result_t SendDeltaMsg.sendDone(TOS_MsgPtr _msg, result_t _success) { > cqueue_popFront( &queue ); > if (cqueue_isEmpty( &queue )) { > call Leds.redOff(); > } > return SUCCESS; > } > /************************* SEND ************************************/ > event result_t SnoopDeltaMsg.intercept(TOS_MsgPtr _msg, void* payload, > uint16_t payloadLen) { > blinkBlue(); > return SUCCESS; > } > } > ----------------------------------------------------------------------------------------------------------- > > // $Id: Delta.h 896 2006-08-02 02:17:38Z polastre $ > /* > * Copyright (c) 2006 Moteiv Corporation > * All rights reserved. > * > * This file is distributed under the terms in the attached > MOTEIV-LICENSE > * file. If you do not find these files, copies can be found at > * http://www.moteiv.com/MOTEIV-LICENSE.txt and by emailing > [email protected] <mailto:[email protected]>. > */ > #ifndef H_Delta_h > #define H_Delta_h > #include "MultiHop.h" > #define DELTA_QUEUE_SIZE MHOP_DEFAULT_QUEUE_SIZE - > (MHOP_DEFAULT_QUEUE_SIZE >> 2) > enum { > DELTA_TIME = 128, > }; > enum { > AM_DELTAMSG = 33 > }; > typedef struct DeltaMsg { > uint32_t seqno; > uint16_t reading; > uint16_t parent; > uint8_t neighborsize; > uint8_t retransmissions; > uint16_t neighbors[MHOP_PARENT_SIZE]; > uint16_t quality[MHOP_PARENT_SIZE]; > } DeltaMsg; > #endif//H_Delta_h > > > Respectfully, > > > Jacob H. Cox Jr > (706) 413-3841 > "What ever you do, work at it with all your heart, as working for the > Lord..." Colossians 3:23 > > > ------------------------------------------------------------------------ > *From:* Janos Sallai <[email protected]> > *To:* tinyos forum <[email protected]> > *Sent:* Friday, April 24, 2009 11:44:21 AM > *Subject:* Re: [Tinyos-help] A simple question > > Zhen, > > You should program the motes using avrdude instead. The version of > avrdude that comes with tinyos supports the mib510. > > Janos > > On Fri, Apr 24, 2009 at 10:20 AM, Li, Zhen <[email protected] > <mailto:[email protected]>> wrote: > > Hi all: > > > > How can I use the MIB510 and some cygwin commands like "make iris > > reinstall..." or maybe other commands to download some *.hex created > by ICC > > AVR into the IRIS mote. > > > > Thanks! > > > > Zhen Li > > _______________________________________________ > > Tinyos-help mailing list > > [email protected] > <mailto:[email protected]> > > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > > > _______________________________________________ > Tinyos-help mailing list > [email protected] > <mailto:[email protected]> > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > > > ------------------------------------------------------------------------ > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
