Show Posts
Pages: 1 ... 16 17 [18] 19
256  Using Arduino / Motors, Mechanics, and Power / Re: New 28BYJ-48 library on: January 30, 2012, 01:08:30 pm
Could please post an example sketch using the code # button? I can't figure out the code in the first post.
257  Using Arduino / General Electronics / Re: Power from wall socket with USB connected? on: January 29, 2012, 05:18:00 am
I power the nrf24l01 from the 3,3V pin, according to the official Arduino website the 3,3V bus is limited to 50mA. The datasheet of the nrf24l01 says that the chip only draws 12mA max. If I connect the module to my Uno I works without problems (powered by USB only). Weird  smiley-confuse
258  Using Arduino / General Electronics / Re: Power from wall socket with USB connected? on: January 28, 2012, 04:57:31 pm
Ok, thank you.
259  Using Arduino / General Electronics / Power from wall socket with USB connected? on: January 28, 2012, 04:01:07 pm
Will this work? Connect a 9V/1,1A power adapter AND usb cable from my pc to read the serial monitor. Will the Arduino Mega 2560 select the power adapter and can the USB still be used to read the serial monitor?
It's just for testing purposes, I'm having some strange issues with my Mega 2560 connected to a nRF24L01+. When I just have the USB cable connected I get very bad reception and lots of time outs but with the power adapter connected it seems to work fine. I want to have a look with the serial monitor to see what happens.
260  Using Arduino / Motors, Mechanics, and Power / Re: New 28BYJ-48 library on: January 28, 2012, 06:42:04 am
I'm interested in this, I have 2 of these little motors. Can't believe they have enough power to spin a DSLR. Please make a video of it smiley-grin
261  Using Arduino / Networking, Protocols, and Devices / Re: rf2401 problem with mega 2560 on: January 28, 2012, 06:36:30 am
Just tested 2 Nrf24L01 modules, one connected to an Uno the other to a Mega 2560. I tested them with the getting started sketch that comes with the library. In the sketch for the Mega I set (radio(49,53)) and set pinMode 53 to output. I works but not like it should. About 80% of the pings times out when I transmit from the Mega, when I transmit from the Uno it's a little bit better (about 40% times out). Anyone have any ideas how I can improve this?
262  Using Arduino / Programming Questions / Re: Bytes to decimals to an integer? on: January 25, 2012, 04:24:21 pm
I think it should be 0x12? 18 in hex is 0x12, this works smiley
Thanks for the help.
263  Using Arduino / Programming Questions / Bytes to decimals to an integer? on: January 25, 2012, 04:09:28 pm
I started this from a sketch where a PIR detector turns on a light and after 30 seconds the light goes out. This works. Earlier this week I bought a little DS1307 module and hooked it up through I2C to my Arduino Uno. Now I want to only turn on the light in the evening (lets say after 18:00) and if the PIR detector is high. For the DS1307 module I used some code I found here ->
I can read the time from the DS1307 (serial monitor).
The only bit that doesn't work is this: "if (pirState == HIGH && (hour, DEC) >= 18)"  Do I need to convert the "hour"?
Could someone give me some pointers on how I can accomplish this?
This is the complete sketch:
  PIR detector turns on light, light switches automatically off after 30 seconds.
  Light must only turn on in the evening (after 18:00) 

#include <Wire.h>
const int DS1307_I2C_ADDRESS = 0x68;
const int pir = 2;     // the number of the PIR pin
const int light =  13;      // the number of the light pin

unsigned long on;      //start time for pir light on

int pirState = 0;         // variable for reading the pushbutton status

byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;

// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
  return ( (val/16*10) + (val%16) );

void getDateDs1307()
  // Reset the register pointer
  Wire.requestFrom(DS1307_I2C_ADDRESS, 7);
  // A few of these need masks because certain bits are control bits
  second     = bcdToDec(Wire.receive() & 0x7f);
  minute     = bcdToDec(Wire.receive());
  hour       = bcdToDec(Wire.receive() & 0x3f);  // Need to change this if 12 hour am/pm
  dayOfWeek  = bcdToDec(Wire.receive());
  dayOfMonth = bcdToDec(Wire.receive());
  month      = bcdToDec(Wire.receive());
  year       = bcdToDec(Wire.receive());

void setup() {
  pinMode(light, OUTPUT);     
  pinMode(pir, INPUT);

void loop(){

  Serial.println("  ");
  Serial.print(hour, DEC);
  Serial.print(minute, DEC);
  Serial.print(second, DEC);
  Serial.println("  ");
  Serial.print(month, DEC);
  Serial.print(dayOfMonth, DEC);
  Serial.println(year, DEC);
  delay(2000);   //slow down serial monitor for testing
  pirState = digitalRead(pir);

  if (pirState == HIGH && (hour, DEC) >= 18) {     
    digitalWrite(light, HIGH); 
    on = millis();

  unsigned long currentMillis = millis();

  if ((currentMillis - on) > 30000) {
    digitalWrite(light, LOW);

264  Using Arduino / General Electronics / Re: I2C and voltages on: January 24, 2012, 04:49:30 pm
I didn't know about the PCA9306, looks like a very easy solution if you want to combine 3,3 and 5V I2C devices. Will have to order one smiley Thanks for the info.
265  Using Arduino / Project Guidance / Re: Getting the Accelerometer (ADXL345) to work on: January 23, 2012, 11:47:26 am
The ADXL345 that I have doesn't "start" automatically, I have to sent a command to it before it starts sending data. I don't use the SPI bus like the sparkfun example but the I2C bus with the following library I did have some trouble to get it working, you can read about it on my blog.
266  Using Arduino / Project Guidance / Re: Multi Room Temperature Sensors and Reporting Station on: January 22, 2012, 10:25:46 am
Have a look at this:
267  Using Arduino / Project Guidance / Re: Mega 2560 with Ethernet shield on: January 22, 2012, 09:59:13 am
Have you tried the sketch that zoomkat posted? What does the serial monitor say? Have you tried pinging the ethernet shield from your computer? Is the IP that you used in the sketch in the same range as your computer?
268  Using Arduino / General Electronics / Re: I2C and voltages on: January 21, 2012, 06:39:37 pm
I've been playing with an ADXL345 accelerometer, also a 3,3V device connected to my Uno. I connected 2 4k7 resistors between SDA/SCL and 3,3V. Becomes more difficult when you want to combine 3,3 and 5V devices on the same I2C bus.
269  Using Arduino / Sensors / Re: Help with DHT11 on: January 19, 2012, 12:38:39 pm
Copy and paste did work!  I now need to get the code to calculate dew, convert the temp to F and get evevrything to return whole numbers only.  I am hoping to have my dht11 and my dallas onewires both integrated tonight.  I can get the dht11 to print to the lcd and separately get the onewire to print to lvd, but can't get them both to print.

Have a look at this -> there some code there that will be helpful smiley
270  Using Arduino / Project Guidance / Re: How do you power arduino with a 9V battery? on: January 19, 2012, 11:27:57 am
Very simple, have a look at this ->
Pages: 1 ... 16 17 [18] 19