Show Posts
Pages: 1 2 3 [4] 5 6 ... 16
46  Using Arduino / General Electronics / How to TTL a laser? on: October 10, 2013, 10:21:19 pm
So I want to TTL a laser to modulate it (36-38khz to be more precise) . The thing is I just want to be sure there isn't something I am missing.

Is it OK to just put a transistor on the output side ?
Check the schematic

Also what if I use a switching regulator such as LM2596?? would a similar circuit work as well or is there somethign different about them that I am missing ?

The laser has a capacitor across it's terminals - sure I got to get rid of it, but what could I do to protect it from surges then ??

ohh damn it forgot
47  Using Arduino / Programming Questions / Re: sending float values - I know $d is for integers, but what about float values? on: October 02, 2013, 08:04:03 pm
Naah wait it does work. You are right I should have posted my entire sketch back then - I must have forked up  my dtostrf() implementation.
Thank you all

Code:
##include <EtherCard.h>
#include <OneWire.h>
// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
static byte myip[] = { 192,168,1,200 };
OneWire  ds(A5);  // on pin A5
byte Ethernet::buffer[800];
BufferFiller bfill;

float celsius,fahrenheit;
int temp1,temp2;
char zxc[5];
void setup () {
  if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
    Serial.println( "Failed to access Ethernet controller");
  ether.staticSetup(myip);
  
   Serial.begin(9600);
 
}
  
static word homePage() {
  long t = millis() / 1000;
  word h = t / 3600;
  byte m = (t / 60) % 60;
  byte s = t % 60;
  bfill = ether.tcpOffset();
  bfill.emit_p(PSTR(
    "HTTP/1.0 200 OK\r\n"
    "Content-Type: text/html\r\n"
    "Pragma: no-cache\r\n"
    "\r\n"
    "<meta http-equiv='refresh' content='6'/>"
    "<title>Temperature</title>"
    "<hr4>$S C</hr4>"), dtostrf(celsius,3,2,zxc)
      );
  return bfill.position();
}

void loop () {
  
    
 byte i;
  byte present = 0;
  byte type_s;
  byte data[12];
  byte addr[8];

  
  if ( !ds.search(addr)) {
    Serial.println("No more addresses.");
    Serial.println();
    ds.reset_search();
    delay(250);
    return;
  }
  
  Serial.print("ROM =");
  for( i = 0; i < 8; i++) {
    Serial.write(' ');
    Serial.print(addr[i], HEX);
  }

  if (OneWire::crc8(addr, 7) != addr[7]) {
      Serial.println("CRC is not valid!");
      return;
  }
  Serial.println();
 
  // the first ROM byte indicates which chip
  switch (addr[0]) {
    case 0x10:
      Serial.println("  Chip = DS18S20");  // or old DS1820
      type_s = 1;
      break;
    case 0x28:
      Serial.println("  Chip = DS18B20");
      type_s = 0;
      break;
    case 0x22:
      Serial.println("  Chip = DS1822");
      type_s = 0;
      break;
    default:
      Serial.println("Device is not a DS18x20 family device.");
      return;
  }

  ds.reset();
  ds.select(addr);
  ds.write(0x44,1);         // start conversion, with parasite power on at the end
  
  delay(1000);     // maybe 750ms is enough, maybe not
  // we might do a ds.depower() here, but the reset will take care of it.
  
  present = ds.reset();
  ds.select(addr);    
  ds.write(0xBE);         // Read Scratchpad

  Serial.print("  Data = ");
  Serial.print(present,HEX);
  Serial.print(" ");
  for ( i = 0; i < 9; i++) {           // we need 9 bytes
    data[i] = ds.read();
    Serial.print(data[i], HEX);
    Serial.print(" ");
  }
  Serial.print(" CRC=");
  Serial.print(OneWire::crc8(data, 8), HEX);
  Serial.println();

  // convert the data to actual temperature

  unsigned int raw = (data[1] << 8) | data[0];
  if (type_s) {
    raw = raw << 3; // 9 bit resolution default
    if (data[7] == 0x10) {
      // count remain gives full 12 bit resolution
      raw = (raw & 0xFFF0) + 12 - data[6];
    }
  } else {
    byte cfg = (data[4] & 0x60);
    if (cfg == 0x00) raw = raw << 3;  // 9 bit resolution, 93.75 ms
    else if (cfg == 0x20) raw = raw << 2; // 10 bit res, 187.5 ms
    else if (cfg == 0x40) raw = raw << 1; // 11 bit res, 375 ms
    // default is 12 bit resolution, 750 ms conversion time
  }
  celsius = (float)raw / 16.0;
  fahrenheit = celsius * 1.8 + 32.0;
  Serial.print("  Temperature = ");
  Serial.print(celsius);
  Serial.print(" Celsius, ");
  Serial.print(fahrenheit);
  Serial.println(" Fahrenheit");
  
 temp1 = abs(celsius);
 temp2 = abs((celsius - temp1) * 100) ;
 
  word len = ether.packetReceive();
  word pos = ether.packetLoop(len);

  if (pos)  // check if valid tcp data is received
ether.httpServerReply(homePage()); // send web page data
}
Messy I know

ohh and BTW is it just my impression that the ENC28J60 Ethernet library is just a nightmare to use - unless you have background in C++ or something
48  Using Arduino / Programming Questions / Re: sending float values - I know $d is for integers, but what about float values? on: October 02, 2013, 07:42:03 pm
I checked both %s and %S and nothing works

bfill.emit_p is defined here -> http://jeelabs.net/pub/docs/ethercard/classBufferFiller.html
and I found that...

Quote
#define PGM_P   const char *

Used to declare a variable that is a pointer to a string in program space.
but WTF it means is beyond me
 smiley

anyway I used a workaround solution, but I regret not reading on ethernet shields first. I bought one based on ENC28J60 IC just because it was smaller. Now that I see how simple standard ethernet library is when compared with the one for ENC28J60 I cry a little.
49  Using Arduino / Programming Questions / Re: sending float values - I know $d is for integers, but what about float values? on: October 02, 2013, 05:16:01 pm
awesome
....but I still need a character to put after a dollar sign for it to work - it seems $D expects an integer
50  Using Arduino / Programming Questions / sending float values - I know $d is for integers, but what about float values? on: October 02, 2013, 03:41:26 pm
I tried searching for it but I can't find equivalent symbol for sending float values. I do know $D is for integers.
I created a server that displays temperature values using ENC28J60 library. Everything works fine, but I can't display float values and I know it's because of the symbol. If I convert temperature to integer then it works just fine. Sure I could make a workaround this and use integers, but I really want to know what's the symbol for floats ?
Code:
bfill.emit_p(PSTR(
    "HTTP/1.0 200 OK\r\n"
    "Content-Type: text/html\r\n"
    "Pragma: no-cache\r\n"
    "\r\n"
    "<meta http-equiv='refresh' content='6'/>"
    "<title>Temperature</title>"
    "$D C"),
      temp);
  return bfill.position();
51  Community / Exhibition / Gallery / Re: Using android mobile to control arduino on: September 28, 2013, 09:51:17 am
Thx santos - I am glad I could help


Here is the new video ->

It's really basic
the arduino sketch is here:
Code:

// pins for the LEDs:
const int redPin = 9;
const int greenPin = 10;
const int bluePin = 11;

void setup() {
  // initialize serial:
  Serial.begin(19200);
  // make the pins outputs:
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
  Serial.setTimeout(50);
}

void loop() {
  // if there's any serial available, read it:
  while (Serial.available() > 0) {

    // look for the next valid integer in the incoming serial stream:
    int red = Serial.parseInt();
    // do it again:
    int green = Serial.parseInt();
    // do it again:
    int blue = Serial.parseInt();

    // look for the newline. That's the end of your
    // sentence:
    if (Serial.read() == '\n') {
      // constrain the values to 0 - 255 and invert
      // if you're using a common-cathode LED, just use "constrain(color, 0, 255);"
      red = 255 - constrain(red, 0, 255);
      green = 255 - constrain(green, 0, 255);
      blue = 255 - constrain(blue, 0, 255);

      // fade the red, green, and blue legs of the LED:
      analogWrite(redPin, red);
      analogWrite(greenPin, green);
      analogWrite(bluePin, blue);

  
      
    }
  }
}
Obviously you might have to change baud rate if your module uses different

rgb_1.apk is the app
rgb_1.zip is a source file for use with app inventor (to upload the source it into app inventor you have to click on more actions button right next to to new button you use to create new projects - there is an option upload source. Just select it an upload the file)

Wiring is almost exactly the same as in here -> http://arduino.cc/en/Tutorial/ReadASCIIString
but I used pins 9,10 and 11 instead of 3,5 and 6.

NOTICE
If you're not logged in as a member here you can't see the attachments so you can't download them. I just realized this problem. So if for the aforementioned reason you can't see the files just try this link instead ->>
https://drive.google.com/folderview?id=0B_PfPoEotOF8N2JwT3RSX011SjQ&usp=sharing
52  Community / Exhibition / Gallery / Re: Using android mobile to control arduino on: September 26, 2013, 02:52:37 pm
I'll add a new example app soon - I still have to film it. Support for sliders has recently been added so I just want to show you how to use them to control RGB lights (and how to send several values using send string and parse int on arduino side)

ohh and if you have any suggestions or ideas for apps feel free to post them - I am running out of ideas  smiley
53  Community / Exhibition / Gallery / Re: Using android mobile to control arduino on: September 03, 2013, 07:09:54 am
Quote
do you have a better idea for me to debugg this code
You should have tested communication of both devices, that is use Putty/Serial monitor and a USB bluetooth dongle to:
A) check if the arduino responds to manually entered commands
B) see what does the phone and app send

I understand you did A, but you didn't do B.

The two procedures pretty much help in 95% of cases

EDIT
Ohh and I double checked your project and I just found out another error. You'll see what I mean when you do what I described above
54  Using Arduino / Motors, Mechanics, and Power / Re: Stepper Motor or Servo Motor, which one I need? on: September 01, 2013, 02:46:37 am
Quote
So far I tried the 5v 28BYJ-48 motor with ULN2003 controller, but it appears to be rather weak and inaccurate at taking small steps, especially with some load on top of it. It could turn by 0.5 degrees one time and for 1.5 anothe
I've never used one but that's surprising - are you sure it wasn't caused by the code or wrong wiring ? I expect them to be much more precise
55  Community / Exhibition / Gallery / Re: Using android mobile to control arduino on: August 31, 2013, 12:44:32 pm
I see you haven't set delimiter byte

It's under components - select BluetoothClient1 and there you can enter delimiter byte. Set it to 13 and see if it helps.
56  Using Arduino / Project Guidance / Re: Wireless communication on: August 28, 2013, 01:45:44 pm
ohh I see you couldn't find its datasheet ? :-)

Here you are -> http://www.dorji.com/docs/data/DRF4432D20I.pdf

Its TX and RX pins are 5V so you can hook them up directly to arduino, no level shifting required. Anyway there is wiring diagram there
57  Using Arduino / Project Guidance / Re: Wireless communication on: August 26, 2013, 03:01:07 pm
Yeah, I agree that the ones you got are really cheap. Bare modules cost $24 so that's $48 for a pair. The ones you got also come with an antena.
Have you tested their max range?? How well do they perform?
58  Community / Exhibition / Gallery / Re: Using android mobile to control arduino on: August 15, 2013, 06:34:03 pm
as I said tens of times in this thread: get a bluetooth dongle and use a terminal program (such as putty) to check if:
A) the app is sending
B) the BT module reacts to manualy entered commands (through serial)

But even before that check if TX pin on the BT module is connected with RX pin on arduino
59  Community / Exhibition / Gallery / Re: Using android mobile to control arduino on: August 14, 2013, 11:23:58 am
Glad I could help even if I didn't  smiley-slim

Anyway here is my newest project that also interfaces arduino and android devices - nothing fancy really it just a wireless ignitor



more details here -> http://www.instructables.com/id/Wireless-cell-phone-igniter/
60  Community / Exhibition / Gallery / Re: Using android mobile to control arduino on: August 13, 2013, 01:09:47 pm
You're 100% sure that TX light is flashing ?? since you're sending stuff to the arduino board shouldn't the RX LED flash ?? I am away from my board ATM so I can't check whether RX or TX flashes when it receives but I think it should be RX not TX

Is the bluetooth module TX pin connected to RX pin on the arduino board ?? it should be. If it isn't correct that


If you want to check exactly what is being sent from the module to the board then use software serial to create another UART port on other pins and create a sketch that retrieves whatever is sent through that serial and passes it to hardware serial (and thought USB connection to the computer where it can be seen using a serial monitor)
The reason why you need to use software serial is because you can't have anything connected to hardware uart pins and use serial through USB connection.
Pages: 1 2 3 [4] 5 6 ... 16