Show Posts
Pages: [1]
1  Using Arduino / General Electronics / Re: BS170 N and gps tx/rx error on: January 22, 2014, 01:41:26 am
Typical threshold voltages are where the device is conducting a mA or less.

Here the datasheet says the threshold voltage could be anything from 0.8 to 3V for
a 1mA drain current.  Threshold voltages always have a big spread between devices BTW.

So basically the best you can expect from the best devices at 3.3V is in the few milliamps to
few tens of mA.

The device has its on-resistance only given for a Vgs of 10V - so that's the gate voltage
you are supposed to use.  Not 5V, not 3.3V, but 10V.

The key specification you need to see for a 5V logic level MOSFET is this:

"Rds(on) at Vgs=4.5V"  (or occasionally Vgs=5V but 4.5V allows for sub-standard
supply voltage)

For a MOSFET for 3.3V operation that would be Vgs=3V or less.

You can always ignore the threshold voltage when driving a MOSFET from CMOS
since you won't have any problem turning it off.

In practice most of the MOSFETs for 3.3V logic operation are surface-mount, you
might be better off with a good NPN switching transistor instead.


You learn something new everyday. smiley

Is one of these and option?

http://no.farnell.com/on-semiconductor/bss138lt3g/mosfet-n-ch-50v-0-2a-sot-23/dp/2101819
http://no.farnell.com/fairchild-semiconductor/fdv301n/n-channel-mosfet-220ma-25v-sot23/dp/9845011

Do you have a link to a good NPN switching transistor?
I have had problems with transistor voltage drop, have not found a solution to that after searching.

2  Using Arduino / General Electronics / Re: BS170 N and gps tx/rx error on: January 21, 2014, 06:59:26 am
Is your Pro Mini running from 5 or 3.3V? If 3.3V, it is not enough voltage to turn it on.
Its rated for 5-3v, have tried to run it on 5v but no difference.



It's 3.3v, do you mean turning on the mosfet or the gps?
Because the gps works fine on 3.3v without the mosfet

GPS devices take a while to start working,  even with backup power for their satellite status.    Turning it on and off really fast,  seems to me to be a misconceived plan.

It's not going to be turned on/off fast. I need to save power.

How do you know what serial output you are getting ?

You didn't try connecting both your GPS and your computer to the same Rx/Tx on your arduino, did you ?

Yes, I'm just forwarding the RX sentences. Works fine without the mosfet.
3  Using Arduino / General Electronics / Re: BS170 N and gps tx/rx error on: January 21, 2014, 06:03:57 am
Yes, i'm trying to cut its power.
It looks like the bs170 is turning on and off rely fast. I can see a faint flash on a LED.
Tried to put a 470uf from drain to 3.3v and I get 4 more characters.

If I wire the GPS direct to ground there is no problems with nmea sentences and power.
It consumes 70mAh
4  Using Arduino / General Electronics / Re: BS170 N and gps tx/rx error on: January 21, 2014, 02:50:30 am

This works with the Uno.
Have tried with a 10k on GND and it makes no difference.
The gps works on the breadboard Arduino if I don't use the BS170.
5  Using Arduino / General Electronics / BS170 N and gps tx/rx error on: January 20, 2014, 12:02:15 pm
Hi all,

I have cheap uBlox gps receiver and would like to turn it on and of with a breadboard atmega328(pro mini 8mhz, 3.3v bootloader).

With an Uno I can switch the gps on and off without problems.
When I use the breadboard Arduino there is only the first 6 character of the NMEA string over and over on the same line, a new line is only created after the mosfet turns of.

Have tried to connect a LED and it turn on/off as expected. The breadboard Arduino can also turn on and off the Uno without any problems with RX/TX. Its only the gps that's not working correctly.

Its the same result if I read the gps data trough the breadboard Arduino or an FTDI.
5v and 3.3v to gps makes no difference.

BS170(http://no.farnell.com/jsp/search/productdetail.jsp?SKU=1017687)

Any help would be appreciated.
6  Products / Arduino GSM Shield / GSM losing connection on: September 14, 2013, 06:03:14 am
Hi

I have a problem with two Arduino GSM Shield.
Its setup to update send a GET command. It can update one or two times before I get connection failed.

I bought one from robotshop.com three weeks ago and that one works without problems.
Bought two more now and have this problem with both of them.

If I switch to the shield that works with same code and same sim card everything works.

Anyone have any idea of what the problem might be?

edit: Status led flashes once and after that it wont update.

Martin
7  Using Arduino / Networking, Protocols, and Devices / Re: PC Coordinator + XBee Arduino + API mode on: December 16, 2012, 05:40:44 am
Hi

has anyone found a solution to this problem?
8  Using Arduino / Storage / Re: Reading microSD card directly from USB serial port on: December 04, 2012, 01:03:05 pm
It wouldn't be possible to connect directly with the sd card trough a separate usb cable hooked onto the sd shield?
Not going trough Arduino, so the sd cards looks just like a normal card connected directly to the pc.

My problems is that I need to make a watertight enclosure and i need access to the sd card files.

Martin
9  Using Arduino / Networking, Protocols, and Devices / Re: Use coordinator to tell xbee(series1) end devices when to send data on: November 11, 2012, 03:31:41 am
The softserial is where the xbee module is connected.
Code:
  softserial.begin(9600);
  xbee.setSerial(softserial);
  xbee.begin(softserial);


I've been fiddling around with different delay times after xbee.send(remoteHigh1); but have not found a solution there.
PaulS, you write your post like you know how to fix the issue, please let me know instead of writing it like a teacher....


10  Using Arduino / Networking, Protocols, and Devices / Use coordinator to tell xbee(series1) end devices when to send data on: November 10, 2012, 04:06:44 am
Hi

I'm trying to get 3 end devices and 1 coordinator to talk together.

My setup is series 1 and AP2 mode.
When the end devices just send with a delay (1000ms) the coordinator might not receive data from all three end devices. So one end device might get trough with its data more than the others.

What I have tried is to hook up pin 20 on end devices to a digital pin on Arduino to read if its high or low.

Coordinator sends an AT request to set pin 20 high on end device #1.
When end device #1 is high it sends data back to coordinator.

This works sort of, the end device sends but it like the coordinators not in sync and doesn't always receive the data.
With the counter I have in end device code it can jump as much as 100 at a time. I would like it to count 1 at a time.

Have also tried to get the end devices to set there own pin20 to low at end of code, but when I do this it won't send any data.
Any suggestions. Used google, read other forums post, pdf documents, but none the wiser.

End device code below
Code:
#include <SoftwareSerial.h>
#include <XBee.h>

SoftwareSerial softserial(2, 3); // RX, TX


XBee xbee = XBee();
uint8_t package[] = { 0, 0, 0  };
Tx16Request tx1 = Tx16Request(0x1234, package, sizeof(package));


// Set DIO0 (pin 20)
uint8_t d0Cmd[]={'D','0'};
uint8_t valueHigh[]={5};
uint8_t valueLow[]={4};

int xbeePin20 = 6;                 // LED connected to digital pin 13
int times;

void setup()
{
  Serial.begin(115200);
  pinMode(xbeePin20, INPUT);  
  
    softserial.begin(9600);
  xbee.setSerial(softserial);
  xbee.begin(softserial);
  
  delay(5000);
}

void loop()
{

  
  while  (digitalRead(xbeePin20) == 0){
    
    
   Serial.println("pin 0 is LOW");  
 
  }  

     times = times + 1; //adds 1 to see if all the data is received.
     package[1] = times >> 8 & 0xff;
     package[2] = times & 0xff;
    
       xbee.send(tx1);      
    
    Serial.print("pin 0 is HIGH");
    Serial.println(digitalRead(xbeePin20));
  
    
    }

Coordinator code. I have removed the code for the other Xbees as I first need coordinator to receive from just 1 end device all the time.
Code:
#include <XBee.h>
#include <SoftwareSerial.h>

SoftwareSerial softserial(2, 3); // RX, TX
XBee xbee = XBee();


XBeeResponse response = XBeeResponse();
Rx16Response rx16 = Rx16Response();

int value1;
int value2;
int value3;

int count1;
int count2;
int count3;



// allocate two bytes for to hold a 10-bit analog reading
uint8_t payload1[] = { 0, 0, 0 };
uint8_t payload2[] = { 0, 0, 0 };
uint8_t payload3[] = { 0, 0, 0 };

// Set DIO0 (pin 20)
uint8_t d0Cmd[]={'D','0'};
uint8_t valueHigh[]={5};
uint8_t valueLow[]={4};

// SH + SL of your remote radio
XBeeAddress64 remoteAddress1 = XBeeAddress64(0x0013a200, 0x407C917C);
XBeeAddress64 remoteAddress2 = XBeeAddress64(0x0013a200, 0x4002392E);
XBeeAddress64 remoteAddress3 = XBeeAddress64(0x0013a200, 0x400239EE);

// Create a remote AT request with the IR command
RemoteAtCommandRequest remoteHigh1 = RemoteAtCommandRequest(remoteAddress1, d0Cmd, valueHigh, sizeof(valueHigh));
RemoteAtCommandRequest remoteHigh2 = RemoteAtCommandRequest(remoteAddress2, d0Cmd, valueHigh, sizeof(valueHigh));
RemoteAtCommandRequest remoteHigh3 = RemoteAtCommandRequest(remoteAddress3, d0Cmd, valueHigh, sizeof(valueHigh));

//set low
RemoteAtCommandRequest remoteLow1 = RemoteAtCommandRequest(remoteAddress1, d0Cmd, valueLow, sizeof(valueLow));
RemoteAtCommandRequest remoteLow2 = RemoteAtCommandRequest(remoteAddress2, d0Cmd, valueLow, sizeof(valueLow));
RemoteAtCommandRequest remoteLow3 = RemoteAtCommandRequest(remoteAddress3, d0Cmd, valueLow, sizeof(valueLow));


void setup() {
  
  Serial.begin(115200);
  
  softserial.begin(9600);
  xbee.setSerial(softserial);
  xbee.begin(softserial);
  
  delay(5000);
  
}

void loop() {
    



xbee.send(remoteHigh1);  


 xbee.readPacket();  
 

  
    if (xbee.getResponse().isAvailable()) {
      // got something
      
      if (xbee.getResponse().getApiId() == RX_16_RESPONSE) {
        // got a rx packet
        
        if (xbee.getResponse().getApiId() == RX_16_RESPONSE) {
                xbee.getResponse().getRx16Response(rx16);
         for (int i = 0; i < rx16.getDataLength(); i++)
          payload1[i] = rx16.getData(i);
          
       }
          
    }
  
 
   uint8_t analogHigh1 = payload1[1];
   uint8_t analogLow1 = payload1[2];
   value1 = analogLow1 + (analogHigh1 * 256);
  
 
  count1 = count1 + 1;
  
   Serial.print("value1  ");
   Serial.print(value1);
     Serial.print("    ");
   Serial.println(count1);
   xbee.send(remoteLow1);  
  
   delay (500);
   }
    
  
    
      
}



  


11  Using Arduino / Networking, Protocols, and Devices / Re: Xbee series 1 API coordinator request data(polling?) on: November 02, 2012, 11:14:32 am
I've been trying to figure this put for myself.

Coordinator has MY:1234
End Device has MY: 1235-1236-1237.

What I'm trying to do is make Coordinator send a message to each of the End Devices and get a response before going to the next one.
It seems that every End Device gets the message even with the address for sending set to one of the End Devices.
The code posted works but it seems to halt for more than the delay time at times and some End Device packets gets delivered more than others.


The data will be updated every second and the Coordinator needs to collect from up to 6 End Devices if possible.

I would thinks there is a easier way of doing this, I'm just having a hard time finding it.



My Coordinator code:
Code:
#include <XBee.h>
#include <SoftwareSerial.h>
/*
This example is for Series 1 XBee
Sends a TX16 or TX64 request with the value of analogRead(pin5) and checks the status response for success
Note: In my testing it took about 15 seconds for the XBee to start reporting success, so I've added a startup delay
*/
SoftwareSerial softserial(2, 3); // RX, TX
XBee xbee = XBee();

//rx
XBeeResponse response = XBeeResponse();
// create reusable response objects for responses we expect to handle
Rx16Response rx16 = Rx16Response();
//
int value1;
int value2;
int value3;

int count1;
int count2;
int count3;

unsigned long start = millis();

// allocate two bytes for to hold a 10-bit analog reading
uint8_t payload1[] = { 1, 0 };
uint8_t payload2[] = { 2, 0 };
uint8_t payload3[] = { 3, 0 };

uint8_t node11[] = { 0, 0, 0 };
uint8_t node22[] = { 0, 0, 0 };
uint8_t node33[] = { 0, 0, 0 };

// with Series 1 you can use either 16-bit or 64-bit addressing

// 16-bit addressing: Enter address of remote XBee, typically the coordinator
Tx16Request node1 = Tx16Request(0x1235, payload1, sizeof(payload1));
Tx16Request node2 = Tx16Request(0x1236, payload2, sizeof(payload1));
Tx16Request node3 = Tx16Request(0x1237, payload3, sizeof(payload3));



void setup() {
  
  Serial.begin(9600);
  
  softserial.begin(9600);
  xbee.setSerial(softserial);
  xbee.begin(softserial);
}

void loop() {
  
      
    
  
    data_in_1 ();
      softserial.flush();
  
  
    data_in_2 ();
     softserial.flush();
    data_in_3 ();
    softserial.flush();
    
      
 
}


    void data_in_1 (){
  xbee.send(node1);    
    delay (5);
          
      
   xbee.readPacket();
    
    if (xbee.getResponse().isAvailable()) {
      // got something
      
      
        
        if (xbee.getResponse().getApiId() == RX_16_RESPONSE) {
                xbee.getResponse().getRx16Response(rx16);
         for (int i = 0; i < rx16.getDataLength(); i++)
          node11[i] = rx16.getData(i);
          
        }
      }
    
    
    if (node11[0] == 1){
    
    uint8_t analogHigh1 = node11[1];
   uint8_t analogLow1 = node11[2];
   value1 = analogLow1 + (analogHigh1 * 256);
 
  count1 = count1 + 1;
  
   Serial.print(value1);
     Serial.print("    ");
   Serial.println(count1);
    
  
    }
  delay (50);
    }
    
  
    void data_in_2 (){
 
      
      
     xbee.send(node1);    
    delay (5);
          
      
   xbee.readPacket();
    
    if (xbee.getResponse().isAvailable()) {
      // got something
      
      
        
        if (xbee.getResponse().getApiId() == RX_16_RESPONSE) {
                xbee.getResponse().getRx16Response(rx16);
         for (int i = 0; i < rx16.getDataLength(); i++)
          node22[i] = rx16.getData(i);
          
        }
      }
    
     if (node22[0] == 2){
      
    uint8_t analogHigh2 = node22[1];
   uint8_t analogLow2 = node22[2];
   value2 = analogLow2 + (analogHigh2 * 256);
  
  count2 = count2 + 1;
  
   Serial.print(value2);
     Serial.print("    ");
   Serial.println(count2);
 
  
    
     }
 delay (50);
    }
  
  
    void data_in_3 (){
 
       xbee.send(node1);
       delay (5);
    
      xbee.readPacket();
      
     if (xbee.getResponse().isAvailable()) {
      // got something
      
      
        
        if (xbee.getResponse().getApiId() == RX_16_RESPONSE) {
                xbee.getResponse().getRx16Response(rx16);
         for (int i = 0; i < rx16.getDataLength(); i++)
          node33[i] = rx16.getData(i);
          
        }
      }
    
     if (node33[0] == 3){
      
    uint8_t analogHigh3 = node33[1];
   uint8_t analogLow3 = node33[2];
   value3 = analogLow3 + (analogHigh3 * 256);
  
 
  
   count3 = count3 + 1;
  
   Serial.print(value3);
     Serial.print("    ");
   Serial.println(count3);
  
   Serial.println();
  
     }
  
   delay (50);
 
    }
    

One of the three End Device codes.

Code:
#include <XBee.h>
#include <SoftwareSerial.h>
/*
This example is for Series 1 XBee (802.15.4)
Receives either a RX16 or RX64 packet and sets a PWM value based on packet data.
Error led is flashed if an unexpected packet is received
*/
SoftwareSerial softserial(2, 3); // RX, TX
XBee xbee = XBee();
XBeeResponse response = XBeeResponse();
// create reusable response objects for responses we expect to handle
Rx16Response rx16 = Rx16Response();



uint8_t payload[] = { 0, 0 };
uint8_t txx[] = { 1, 0, 0  };

//tx
Tx16Request tx = Tx16Request(0x1234, txx, sizeof(txx));

//



void setup() {
  
  
  // start serial
  Serial.begin(9600);
  xbee.setSerial(Serial);
  xbee.begin(Serial);
  
 
}

// continuously reads packets, looking for RX16 or RX64
void loop() {
    
    xbee.readPacket();
    
    if (xbee.getResponse().isAvailable()) {
      // got something
      
      if (xbee.getResponse().getApiId() == RX_16_RESPONSE) {
        // got a rx packet
        
        if (xbee.getResponse().getApiId() == RX_16_RESPONSE) {
                xbee.getResponse().getRx16Response(rx16);
         for (int i = 0; i < rx16.getDataLength(); i++)
          payload [i] = rx16.getData(i);
      
    
  
          
      }
  
        }
    
     }
    
    if(payload[0] == 1){
      
      Serial.println(payload[0]);
      int pin5 = 5;
     txx[1] = pin5 >> 8 & 0xff;
     txx[2] = pin5 & 0xff;
      
      xbee.send(tx);
    }else {
    
      Serial.println("not correct id");
      
    }
    
    
    
    
  
    }
  
   
12  Using Arduino / Networking, Protocols, and Devices / Re: Xbee series 1 API coordinator request data(polling?) on: October 29, 2012, 12:34:57 am
Hi PaulS

Yes I'm using Xbee in AP2 mode.

I'm having no problems sending bytes from end node to coordinator.

Problems starts when I want receive bytes from 3 different endnodes, data crashes. I don't know what field in coordinator to put the address for end node into.

The book is based on series2/zigbee, haven't found what I'm looking for there. If its there please point me in the right directions.


13  Using Arduino / Networking, Protocols, and Devices / Xbee series 1 API coordinator request data(polling?) on: October 28, 2012, 02:09:24 pm
Hi

I'm having some trouble finding out how i get my coordinator to request the different end nodes to send data, so no data is lost.
Now i have 3 end nodes and 1 coordinator, might be more end nodes later.
I'm using the xbee library and can't see anything on code.google site. It's possible I've read myself blind.
Have used google but still no clue on how to do it.

Any help would be much appreciated.

14  Using Arduino / Networking, Protocols, and Devices / Re: Xbee node selection by range from main Xbee on: September 15, 2012, 12:41:35 pm
All of the nodes and the main will have gps
15  Using Arduino / Networking, Protocols, and Devices / Xbee node selection by range from main Xbee on: September 14, 2012, 03:12:07 pm
Hi

Have tried google it but not sure what search terms to use.
I need some help figuring out how to get a main Xbee talking to the Xbee node thats closest.

Made some overview images, hope this explains it good enough.

The different Xbee nodes are sending sensor values, so the main Xbee needs to receive the values thats most relevant to its position.

Many thanks!



Pages: [1]