Show Posts
Pages: 1 [2] 3 4 ... 30
16  Using Arduino / Networking, Protocols, and Devices / How can I test this serial BlueTooth module? on: March 11, 2014, 03:01:24 am
I got a bluetooth module for my HobbyKing MultiWii 328 quadcopter board but it simply doesn't work despite my trying everything I can imagine. My phone will connect to the module but I get no data, not even a raw stream.

I tried connecting it to my UNO to see if it was faulty and I am not sure about the results. I can only send data from the phone if I don't set up Serial in the arduino sketch, and just use the window to listen. If I set up Serial so that I can send to the phone, it works, but then I can't send from the phone anymore, even using the serial read example. Then in both situation, reversing RX and TX doesn't seem to change anything. If I try to use serial read and write in the same sketch they seem to interfere with each other. I have everything set to 115200.

Using just the phone, with the BT module powered, but RX and TX not connected, it acts like it's looped back, even though I haven't looped RX and TX.

So rather than guessing, how can I determine for sure if this thing is faulty?
17  Using Arduino / Programming Questions / How to drive 433MHz transmitter without library on: February 24, 2014, 12:42:23 am
I have no trouble with my 433MHz transmitter, but I would like to know how to drive it without a library. Basically I want to know how it actually works and not just rely on the library. But of course whenever I google it, I just find people talking about how to use the libraries.
18  Using Arduino / Displays / Re: Touch LCD clone looks weird unless resetting on: February 11, 2014, 12:08:50 am
Here is the exact code, I've only modified it to load one image at startup:
#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_TFTLCD.h> // Hardware-specific library
#include <SD.h>

// The control pins for the LCD can be assigned to any digital or
// analog pins...but we'll use the analog pins as this allows us to
// double up the pins with the touch screen (see the TFT paint example).
#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0

// When using the BREAKOUT BOARD only, use these 8 data lines to the LCD:
// For the Arduino Uno, Duemilanove, Diecimila, etc.:
//   D0 connects to digital pin 8  (Notice these are
//   D1 connects to digital pin 9   NOT in order!)
//   D2 connects to digital pin 2
//   D3 connects to digital pin 3
//   D4 connects to digital pin 4
//   D5 connects to digital pin 5
//   D6 connects to digital pin 6
//   D7 connects to digital pin 7
// For the Arduino Mega, use digital pins 22 through 29
// (on the 2-row header at the end of the board).

// For Arduino Uno/Duemilanove, etc
//  connect the SD card with DI going to pin 11, DO going to pin 12 and SCK going to pin 13 (standard)
//  Then pin 10 goes to CS (or whatever you have set up)
#define SD_CS 10     // Set the chip select line to whatever you use (10 doesnt conflict with the library)

// In the SD card, place 24 bit color BMP files (be sure they are 24-bit!)
// There are examples in the sketch folder

// our TFT wiring
Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, A4);

void setup()


  uint16_t identifier = tft.readID();

  if(identifier == 0x9325) {
    Serial.println(F("Found ILI9325 LCD driver"));
  } else if(identifier == 0x9328) {
    Serial.println(F("Found ILI9328 LCD driver"));
  } else if(identifier == 0x7575) {
    Serial.println(F("Found HX8347G LCD driver"));
  } else {
    Serial.print(F("Unknown LCD driver chip: "));
    Serial.println(identifier, HEX);
    Serial.println(F("If using the Adafruit 2.8\" TFT Arduino shield, the line:"));
    Serial.println(F("  #define USE_ADAFRUIT_SHIELD_PINOUT"));
    Serial.println(F("should appear in the library header (Adafruit_TFT.h)."));
    Serial.println(F("If using the breakout board, it should NOT be #defined!"));
    Serial.println(F("Also if using the breakout, double-check that all wiring"));
    Serial.println(F("matches the tutorial."));


  Serial.print(F("Initializing SD card..."));
  if (!SD.begin(SD_CS)) {
  bmpDraw("woof.bmp", 0, 0);

void loop()


// This function opens a Windows Bitmap (BMP) file and
// displays it at the given coordinates.  It's sped up
// by reading many pixels worth of data at a time
// (rather than pixel by pixel).  Increasing the buffer
// size takes more of the Arduino's precious RAM but
// makes loading a little faster.  20 pixels seems a
// good balance.

#define BUFFPIXEL 20

void bmpDraw(char *filename, int x, int y) {

  File     bmpFile;
  int      bmpWidth, bmpHeight;   // W+H in pixels
  uint8_t  bmpDepth;              // Bit depth (currently must be 24)
  uint32_t bmpImageoffset;        // Start of image data in file
  uint32_t rowSize;               // Not always = bmpWidth; may have padding
  uint8_t  sdbuffer[3*BUFFPIXEL]; // pixel in buffer (R+G+B per pixel)
  uint16_t lcdbuffer[BUFFPIXEL];  // pixel out buffer (16-bit per pixel)
  uint8_t  buffidx = sizeof(sdbuffer); // Current position in sdbuffer
  boolean  goodBmp = false;       // Set to true on valid header parse
  boolean  flip    = true;        // BMP is stored bottom-to-top
  int      w, h, row, col;
  uint8_t  r, g, b;
  uint32_t pos = 0, startTime = millis();
  uint8_t  lcdidx = 0;
  boolean  first = true;

  if((x >= tft.width()) || (y >= tft.height())) return;

  Serial.print(F("Loading image '"));
  // Open requested file on SD card
  if ((bmpFile = == NULL) {
    Serial.println(F("File not found"));

  // Parse BMP header
  if(read16(bmpFile) == 0x4D42) { // BMP signature
    Serial.println(F("File size: ")); Serial.println(read32(bmpFile));
    (void)read32(bmpFile); // Read & ignore creator bytes
    bmpImageoffset = read32(bmpFile); // Start of image data
    Serial.print(F("Image Offset: ")); Serial.println(bmpImageoffset, DEC);
    // Read DIB header
    Serial.print(F("Header size: ")); Serial.println(read32(bmpFile));
    bmpWidth  = read32(bmpFile);
    bmpHeight = read32(bmpFile);
    if(read16(bmpFile) == 1) { // # planes -- must be '1'
      bmpDepth = read16(bmpFile); // bits per pixel
      Serial.print(F("Bit Depth: ")); Serial.println(bmpDepth);
      if((bmpDepth == 24) && (read32(bmpFile) == 0)) { // 0 = uncompressed

        goodBmp = true; // Supported BMP format -- proceed!
        Serial.print(F("Image size: "));

        // BMP rows are padded (if needed) to 4-byte boundary
        rowSize = (bmpWidth * 3 + 3) & ~3;

        // If bmpHeight is negative, image is in top-down order.
        // This is not canon but has been observed in the wild.
        if(bmpHeight < 0) {
          bmpHeight = -bmpHeight;
          flip      = false;

        // Crop area to be loaded
        w = bmpWidth;
        h = bmpHeight;
        if((x+w-1) >= tft.width())  w = tft.width()  - x;
        if((y+h-1) >= tft.height()) h = tft.height() - y;

        // Set TFT address window to clipped image bounds
        tft.setAddrWindow(x, y, x+w-1, y+h-1);

        for (row=0; row<h; row++) { // For each scanline...
          // Seek to start of scan line.  It might seem labor-
          // intensive to be doing this on every line, but this
          // method covers a lot of gritty details like cropping
          // and scanline padding.  Also, the seek only takes
          // place if the file position actually needs to change
          // (avoids a lot of cluster math in SD library).
          if(flip) // Bitmap is stored bottom-to-top order (normal BMP)
            pos = bmpImageoffset + (bmpHeight - 1 - row) * rowSize;
          else     // Bitmap is stored top-to-bottom
            pos = bmpImageoffset + row * rowSize;
          if(bmpFile.position() != pos) { // Need seek?
            buffidx = sizeof(sdbuffer); // Force buffer reload

          for (col=0; col<w; col++) { // For each column...
            // Time to read more pixel data?
            if (buffidx >= sizeof(sdbuffer)) { // Indeed
              // Push LCD buffer to the display first
              if(lcdidx > 0) {
                tft.pushColors(lcdbuffer, lcdidx, first);
                lcdidx = 0;
                first  = false;
    , sizeof(sdbuffer));
              buffidx = 0; // Set index to beginning

            // Convert pixel from BMP to TFT format
            b = sdbuffer[buffidx++];
            g = sdbuffer[buffidx++];
            r = sdbuffer[buffidx++];
            lcdbuffer[lcdidx++] = tft.color565(r,g,b);
          } // end pixel
        } // end scanline
        // Write any remaining data to LCD
        if(lcdidx > 0) {
          tft.pushColors(lcdbuffer, lcdidx, first);
        Serial.print(F("Loaded in "));
        Serial.print(millis() - startTime);
        Serial.println(" ms");
      } // end goodBmp

  if(!goodBmp) Serial.println(F("BMP format not recognized."));

// These read 16- and 32-bit types from the SD card file.
// BMP data is stored little-endian, Arduino is little-endian too.
// May need to reverse subscript order if porting elsewhere.

uint16_t read16(File f) {
  uint16_t result;
  ((uint8_t *)&result)[0] =; // LSB
  ((uint8_t *)&result)[1] =; // MSB
  return result;

uint32_t read32(File f) {
  uint32_t result;
  ((uint8_t *)&result)[0] =; // LSB
  ((uint8_t *)&result)[1] =;
  ((uint8_t *)&result)[2] =;
  ((uint8_t *)&result)[3] =; // MSB
  return result;
19  Using Arduino / Displays / Touch LCD clone looks weird unless resetting on: February 11, 2014, 12:08:31 am
I got this touch LCD clone and I am using the Adafruit TFTLCD tftbmp library/example. The tftbmp_shield example does not work, I assume something to do with pin locations.

Anyway, the screen has weird contrast and seems sort of dim until I hit the reset button. Then it looks great until it restarts and it goes back to looking weird.

Notice how there's the bright blotch in the sky and the pelican is very dark, that is really exaggerated in person. When I hit reset it looks a little washed out in the video but it looks perfect in person.

The same thing happens even if I power it externally with a good quality power adapter. I realize that it being a clone there's a million things that could be wrong but I am hoping that since it is fixed while resetting there is some way to narrow down the problem. What is different while the arduino is about to reset that could be causing thing?
20  Community / Website and Forum / Re: Change email on: June 17, 2013, 02:36:33 am
Sorry, figured it out. It seems odd that you have to do it through the main site and can't through the forum.
21  Community / Website and Forum / Change email on: June 17, 2013, 02:23:39 am
I cannot seem to find where to change my email address for this forum. I need to abandon my yahoo address due to tons of security issues lately.
22  Using Arduino / Project Guidance / Re: ARDUINO POOL ALARM... on: June 12, 2013, 05:34:29 pm
Hate to be another nay sayer but I don't even trust my fish with my electronic competence. Make sure that you keep in mind that anything you make will be a trivial project for fun and should never be considered an actual safety tool.
23  Using Arduino / Project Guidance / Re: Automobile blinker lights on: June 07, 2013, 07:43:48 pm
Why can you not just wire the front blinkers to the back blinkers?
24  Using Arduino / Project Guidance / Re: Lots of cheap solenoids or something similar on: May 31, 2013, 02:22:16 pm
It would have to go down to less than a dollar before I could consider buying what I need. Even making them myself I have to be really cautious with what I pick.

 Found a few different sizes nails, even some really big ones for pretty cheap and some new thread spools that are longer and should allow larger nails to pass through. If the nails are too heavy I might make the solenoids the moving part.
25  Using Arduino / Project Guidance / Re: Lots of cheap solenoids or something similar on: May 30, 2013, 04:08:23 pm
Yeah I considered that but I want sure how big I could find them and how magnetic they would be. I got good pull on a screw driver, I don't know how well a nail might do. I'll go see whati can find.
26  Using Arduino / Project Guidance / Re: Lots of cheap solenoids or something similar on: May 30, 2013, 02:56:04 am
I think we are talking about two completely different things. It sounds like you are talking about the shape of the solenoid. The shape I'm using is simply because of what I found that I can test with. That's all I have to work with right now.

I'm talking about the actuating rod. I'm wanting to know if I should just use a ferrous rod as is normally in a solenoid or if a small neodymium magnet could be used instead. Getting a bunch of ferrous metal rods would be difficult and I don't really have a way to cut them.

It would be ideal to just use small magnets and have wood actuating rods. It would also seem to me that even though the magnet would be much much smaller, since it has its own magnetic field it should align with the solenoid with a great deal of force but I have none that fit into my solenoid so I can't test it.

I don't know if that is true though. That is my question. Will a just a small neodymium magnet attract the solenoid as well as a large temporarily magnetized rod?
27  Using Arduino / Project Guidance / Re: Lots of cheap solenoids or something similar on: May 30, 2013, 02:28:57 am
That still doesn't really answer whether I will get more force from a solenoid making a long rod into a magnet or just having a small magnet.

For the sake of economy I'd at least like to know the difference before trying both at the same time.
28  Using Arduino / Project Guidance / Re: Lots of cheap solenoids or something similar on: May 30, 2013, 01:57:21 am
I just realized it really goes for metal stuff if I pass them into the center of it. So now I'm not sure...

Here the predicament... I believe it want's to sit in the middle of a metal rod when powered on. So if the rod is pretty long and I only allow it to move a centimeter, it is pretty strong. BUT I don't have any magnets that will fit into it so I have no idea of having a small magnet would be stronger or weaker than a large piece of metal.
29  Using Arduino / Project Guidance / Re: Lots of cheap solenoids or something similar on: May 30, 2013, 12:56:04 am
Yeah, I've seen that one. I definitely need to use a magnet in place of a slug, mine has almost no pull to metal but plenty to a magnet. Unfortunately there's not a lot of info on the ideal magnet size or position so I might just have to experiment.
30  Using Arduino / Project Guidance / Re: Lots of cheap solenoids or something similar on: May 30, 2013, 12:01:38 am
Cost is a huge issue, if I could find a way to use these bobbins that would really be good. I'm going to try to experiment to see what kind of heat is generated from a typical amount of use of a commonly used key. Also, depending on how the mechanics work out I can likely lower the voltage if I can get the power I need.

But before I know that I need to know what the most efficient setup is for the permanent magnet. I assume a magnet going through the center is best. But should I spend more to get longer magnets? Or would that not help? Maybe it would help to some extent? I have no idea, does anyone know about that?
Pages: 1 [2] 3 4 ... 30