Show Posts
Pages: 1 2 [3] 4 5 ... 22
31  Using Arduino / Motors, Mechanics, and Power / Re: Motorized Valve on: April 13, 2014, 06:17:39 am
Does the rate of flow need to be controlled or will simple on-off suffice? - Scotty
32  Using Arduino / Project Guidance / Re: Guitar Pickup Winder on: April 04, 2014, 02:02:48 pm
Quote
How fast was the winding being done?
It wasn't very fast; perhaps 75RPM.

Quote
Perhaps the design should have a stepper that moves the entire winding assembly (pickup bobbin and DC motor) back and forth rather than the copper wire?
What would be the difference?

At the time I was thinking that having a piece to guide the wire onto the spool, located very close to the spool might eliminate the lag in changing direction but that would require having that position change relative to the ever increasing diameter of the spool winding. That was more work than I was willing to put into it.

- Scotty
33  Using Arduino / Project Guidance / Re: Guitar Pickup Winder on: April 04, 2014, 08:47:54 am
This project appealed to me a couple of years ago. I put quite a bit of effort into it but it was not an essential project so I decided to move on after not eventually getting it to work correctly. The problem I encountered, and did not resolve, was in changing the left/right direction of the wind. When the end of a layer of wind would come about and a direction change was initiated, the winding wire would want to linger at the end and build up additional layers there. After enough pull in direction change, it would move in the opposite direction but by that time the device pulling the wire would be significantly away from the end. When the wire finally 'obeyed' and did move, it would move way over to it's intended position, skipping over most of the wind from the previous 'end' to it's new position. After only a few iterations of layers, it was a mess of hills and valleys. I used these motors. - Scotty
34  Using Arduino / General Electronics / Re: IR sensor for arduino on: April 04, 2014, 07:56:24 am
I completed this project. To avoid false triggering, I pulsed the transmitter at 38kHz since the receiver is designed to 'see' that frequency. For the IR receiver I used this. For the transmitter I used this. The emitter is driven through a transistor who's 38kHz base signal is derived from a 555 timer. I had problems with getting an accurate frequency with the 555; it was very fussy about the external timing capacitor used. I was able to get a stable frequency using a high precision, low value capacitor. If I were to do it again I would use an Attiny85. No external components (except for decoupling) are needed, very stable, and it costs only about $.40 more than a 555. You would need to learn how to load code to it but that's no big deal. - Scotty
35  Using Arduino / Project Guidance / Smoke alarm detection on: April 02, 2014, 09:12:57 am
Smoke alarm detection is part of a home security project I'm working on. I'm seeking advice on using a 'local' microcontroller to  detect smoke alarm activation and sending a 'smoke alarm activated' signal to a 'master' Arduino. My initial thinking is to make use of the smoke alarms battery as a power source. Doing so, power conservation is a must. Although I've not investigated much, I'm pretty sure I can make use of 'sleep mode' of an Atmel AVR device on a DIY board using perhaps an Attiny85 or like device or using a smaller Arduino such as a mini or micro. Any thoughts on that?

There are most likely several ways to have the smoke detector wake up the micro controller. One that comes to mind is tapping off the alarm's escape light. Any other ideas?

What are your thoughts on what low power, wireless means of transmitting that detection to a 'master' Arduino is most practical? Line of sight is not practical.

All that aside, would it be possible to make use of Kiddie wireless (RF) smoke detectors?

Thanks - Scotty
36  Using Arduino / Project Guidance / Re: Arduino caliper on: March 31, 2014, 07:04:13 am
Rather than build a digital caliper with an Arduino, it may be easier to hack one of the cheap digital calipers and use an Arduino to read the calipers. This has been done by a member of these forums. Simply google "interfacing arduino with a digital caliper". How do they work? Google "how do digital calipers work?". - Scotty
37  Using Arduino / Programming Questions / Re: Arduino > USB Host > RAZR Phone on: March 30, 2014, 07:47:12 pm
Thanks alot Paul. That helped a whole bunch.

Here's the code:
Code:
#include <cdcacm.h>
#include <usbhub.h>

#include "pgmstrings.h"

// Satisfy IDE, which only needs to see the include statment in the ino.
#ifdef dobogusinclude
#include <spi4teensy3.h>
#endif



class ACMAsyncOper :
public CDCAsyncOper
{
public:
  virtual uint8_t OnInit(ACM *pacm);
};

uint8_t ACMAsyncOper::OnInit(ACM *pacm)
{
  uint8_t rcode;
  // Set DTR = 1 RTS=1
  rcode = pacm->SetControlLineState(3);

  if (rcode)
  {
    ErrorMessage<uint8_t>(PSTR("SetControlLineState"), rcode);
    return rcode;
  }

  LINE_CODING lc;
  lc.dwDTERate = 115200;
  lc.bCharFormat = 0;
  lc.bParityType = 0;
  lc.bDataBits = 8;


  rcode = pacm->SetLineCoding(&lc);

  if (rcode)
    ErrorMessage<uint8_t>(PSTR("SetLineCoding"), rcode);

  return rcode;
}

USB     Usb;
//USBHub     Hub(&Usb);
ACMAsyncOper  AsyncOper;
ACM           Acm(&Usb, &AsyncOper);

boolean done = false;
uint8_t rcode;
char mode[] = "AT+CMGF=1\r"; //used to put phone into text mode
int modelen = strlen(mode);
char phone[] = "AT+CMGW=16105551212\n>FROM RAZR\z";
int phonelen = strlen(phone);
char message[] = "From Razr!\r";
int messagelen = strlen(message);

void setup()
{
  Serial.begin( 115200 );
  while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
  Serial.println("Start");

  if (Usb.Init() == -1)
    Serial.println("OSCOKIRQ failed to assert");
  delay( 200 );
}

void loop()
{
  Usb.Task();

  if( Acm.isReady()) {
    //uint8_t rcode;

    /* sending to the phone */
    if (done==false){//if true, prevents multiple messages from being sent

      Mode_Setup();
      delay(500);
      Read_Function();
      delay(500);
      Enter_Number();
      delay(1000);
      //Read_Function();
      //delay(500);
      //Send_Message();
      //delay(500);
      //Read_Function();
      //delay(500); 
    }
    if (rcode)
      ErrorMessage<uint8_t>(PSTR("SndData"), rcode);

    //Serial.println("            DATA SENT");
    done = true;
  }
  delay(50);

}//if( Usb.getUsbTaskState() == USB_STATE_RUNNING..

int Mode_Setup(){
  for (int i = 0; i < modelen; i++){
    uint8_t data = mode[i];
    rcode = Acm.SndData(1, &data);
  }
  Serial.println("                         Mode Setup Complete");
}

int Enter_Number(){
  for (int i = 0; i < phonelen; i++){
    uint8_t data = phone[i];
    rcode = Acm.SndData(1, &data);
    delay(50);
  }
  Serial.println("                         Enter Number Complete");
}

int Send_Message(){
  for (int i = 0; i < messagelen; i++){
    uint8_t data = message[i];
    rcode = Acm.SndData(1, &data);
  }
  Serial.println("                         Send Message Complete");
}

int Read_Function(){
  /* reading the phone */
  /* buffer size must be greater or equal to max.packet size */
  /* it it set to 64 (largest possible max.packet size) here, can be tuned down
   for particular endpoint */
  Serial.println ("In Read Function");
  uint8_t  buf[64];
  uint16_t rcvd = 64;
  rcode = Acm.RcvData(&rcvd, buf);
  if (rcode && rcode != hrNAK)
    ErrorMessage<uint8_t>(PSTR("Ret"), rcode);

  if( rcvd ) { //more than zero bytes received
    for(uint16_t i=0; i < rcvd; i++ ) {
      Serial.print((char)buf[i]); //printing on the screen
    }
  }
  delay(10);
}

I can now send commands to the phone. However, I've run into a little snag. The command I need to use is:
AT+CMGW="phonenumber"\n
 > Type your message here.\z
Which sends a single SMS message.

(The message being embedded in char phone[] in the sketch. Now that I think of it, it makes sense that a number shouldn't be dialed and then the message typed in. The number should be dialed after the message is typed.)

It won't compile because of the \z. The error message is 'unknown escape sequence \z. I've tried adding the decimal value of 26, i.e. char phone[] = "AT+CMGW=16105551212\n>message"+26; in lieu of \z but I get a different error message about the size of 'phone'.

I have been successful in calling another phone using ATD+12125551212; just to ensure I can dial out from the RAZR.

The following is displayed in the serial monitor when the sketch is executed:

Start
0705890300100A0705010200200007058202002000                         Mode Setup Complete
In Read Function
AT+CMGF=1

OK
                         Enter Number Complete


Can anyone suggest a remedy?
Thanks - Scotty
38  Using Arduino / Programming Questions / Re: Arduino > USB Host > RAZR Phone on: March 30, 2014, 07:06:01 pm
Thanks alot Paul. That helped
39  Using Arduino / Programming Questions / Arduino > USB Host > RAZR Phone on: March 28, 2014, 02:09:05 pm
Hello Guys. I'm working on  a project to notify me, via text, of certain conditions at my home. I have been able to send text to the RAZR via the Aduino IDE Serial Monitor, using the sketch below. Of course, I would like the Arduino to send the messages autonomously. Another fellow has been working on the same project and has asked the same question to the author of the sketch. His response was to 'Just replace strings that I send with strings you need to send.' I assume this in reference to the line of code: rcode = Acm.SndData(1, &data);. I've tried different approaches such as filling the variable 'data' with characters, a sting, numeric values, etc. to no avail. Most of the time, the error references some code in the cdcacm library. The error is as follows:

acm_terminal.ino: In function 'void loop()':
acm_terminal:71: error: invalid conversion from 'const char*' to 'uint8_t*'
acm_terminal:71: error: initializing argument 2 of 'uint8_t ACM::SndData(uint16_t, uint8_t*)'

It seems to me it should be relatively easy to have the Arduino send text as is done via the serial monitor. Within an Arduino sketch, is it possible to emulate sending text entered via the serial monitor?

Thanks - Scotty


Code:
#include <cdcacm.h>
#include <usbhub.h>

#include "pgmstrings.h"

// Satisfy IDE, which only needs to see the include statment in the ino.
#ifdef dobogusinclude
#include <spi4teensy3.h>
#endif

class ACMAsyncOper : public CDCAsyncOper
{
public:
    virtual uint8_t OnInit(ACM *pacm);
};

uint8_t ACMAsyncOper::OnInit(ACM *pacm)
{
    uint8_t rcode;
    // Set DTR = 1 RTS=1
    rcode = pacm->SetControlLineState(3);

    if (rcode)
    {
        ErrorMessage<uint8_t>(PSTR("SetControlLineState"), rcode);
        return rcode;
    }

    LINE_CODING lc;
    lc.dwDTERate = 115200;
    lc.bCharFormat = 0;
    lc.bParityType = 0;
    lc.bDataBits = 8;

    rcode = pacm->SetLineCoding(&lc);

    if (rcode)
        ErrorMessage<uint8_t>(PSTR("SetLineCoding"), rcode);

    return rcode;
}

USB     Usb;
//USBHub     Hub(&Usb);
ACMAsyncOper  AsyncOper;
ACM           Acm(&Usb, &AsyncOper);

void setup()
{
  Serial.begin( 115200 );
  while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
  Serial.println("Start");

  if (Usb.Init() == -1)
      Serial.println("OSCOKIRQ failed to assert");

  delay( 200 );
}

void loop()
{
    Usb.Task();

    if( Acm.isReady()) {
       uint8_t rcode;

       /* reading the keyboard */
       if(Serial.available()) {
         uint8_t data= Serial.read();
         /* sending to the phone */
         rcode = Acm.SndData(1, &data);
         if (rcode)
            ErrorMessage<uint8_t>(PSTR("SndData"), rcode);
       }//if(Serial.available()...

       delay(50);

        /* reading the phone */
        /* buffer size must be greater or equal to max.packet size */
        /* it it set to 64 (largest possible max.packet size) here, can be tuned down
        for particular endpoint */
        uint8_t  buf[64];
        uint16_t rcvd = 64;
        rcode = Acm.RcvData(&rcvd, buf);
         if (rcode && rcode != hrNAK)
            ErrorMessage<uint8_t>(PSTR("Ret"), rcode);

            if( rcvd ) { //more than zero bytes received
              for(uint16_t i=0; i < rcvd; i++ ) {
                Serial.print((char)buf[i]); //printing on the screen
              }
            }
        delay(10);
    }//if( Usb.getUsbTaskState() == USB_STATE_RUNNING..
}
40  Using Arduino / Project Guidance / Re: Automated Chicken Feeder - Noob needs help on: March 26, 2014, 07:02:32 am
Quote
turning the motor on for a set time and reversing it the same amount of time to open close the valve?

That method might work sometime but I doubt it would work correctly consistently. The problem with the method is, depending on the load, that there is no way to determine the length of time it will take for the door to open or close. Besides that, the time it will take for the door to open or close will also greatly depend of the charge state of the battery. You cannot recharge a "just those ones you buy from the supermarket" battery.

I think you need to rethink this design. Your current one is just too flawed.

- Scotty
41  Using Arduino / Project Guidance / Re: Automated Chicken Feeder - Noob needs help on: March 25, 2014, 06:56:10 am
Welcome to the forums.
At 12v, under no load, that motor would make 1.2 revolutions in 2 seconds. Rather than controlling the length of time to the open or closed positions, I think a better approach would be to sense the open and closed positions and operate the motor until the desired position is reached. What power supply is used for powering the motor? - Scotty
42  Using Arduino / Programming Questions / Re: HC SR-04 and servo problem. on: March 24, 2014, 06:44:40 am
Welcome to these forums. Please read and follow the instructions contained in the sticky post, the first post on this forum's opening page. - Scotty
43  Using Arduino / Project Guidance / Re: Wiring specifics on: March 21, 2014, 10:51:20 am
Perhaps a single pole double throw wall switch and an Arduino controlled SPDT latching relay, following the wiring of Peter's first link. - Scotty
44  Using Arduino / Project Guidance / Re: Wiring specifics on: March 21, 2014, 06:07:01 am
I'm not clear on the switch. Are you referring to a switch such as a common light switch as might be might be mounted in a wall to control the mains directly or a small, low voltage switch that you might find at Radio Shack that you can attach to an Arduino? - Scotty
45  Using Arduino / Project Guidance / Re: Wiring specifics on: March 20, 2014, 06:49:04 am
Does this circuitry involve AC mains voltage? - Scotty
Pages: 1 2 [3] 4 5 ... 22