text:
Arduino Nano clone doesn't fit into breadboard. How can I work around this?
I have bought an arduino nano clone (called funduino) and upon trying to place it into my breadboard to work with it I realised that the pins do not line up with the holes on the breadboard so I simply can't use the funduino...

Does anyone have any recommendations on how I can get around this?

Is it your breadboard or the funduino that doesn't have the 0.1inch pitch ;)
I see that the last pin (VIN?) is a little bent, you might check if any of the pins is a little of and bend it back in line. Then it should work, given they're both 0.1inch pitch (but I don't see why not).

What is a 0.1inch pitch?

0.254 centimeters pin spacing. The space between two pins.

Have you tried just patience and persistence?  Some of mine feel tight but in the end they go in.  (Bent pins can be unsoldered and new pins can be put in, if you need to do so, but it is best not to push too hard until you are convinced it can be made to work)

bruh I've forgot how to even use my arduino I've not touched it in that long, thanks for the reply though lol

You might be able to use these female to female jumper wires and these headers and hook up the board and breadboard like this:

Note, the square female cable ends may not fit closer than 0.1 inches on center.
A more compact and (possibly) mechanically difficult solution may be implemented using wire-wrap sockets.  You may be able to leave the sockets intact and deform the pins to match the breadboard.  Or you may need to remove the pins from the plastic in order to accommodate your (different) Nano:

I was thinking about that initially, I just didn't want to spend anymore money/ wait for them to arrive haha, would you recommend me attempting to disfigure the device at all?

I thought the Nano's pins were already 0.1 inch on center.  So a picture of why this board doesn't fit into your breadboard would be helpful.  W/o that, I can only guess.  But guessing, what I would do is not disfigure the Nano's pins but to plug it into a "hacked" wire wrap socket(s) (long stiff pins) and disfigure the socket such that it can plug into the breadboard.

These seems much simpler than your current answer. Update it and I'll accept it :)

Found a good wirewrap pin picture. I'll update answer.

Because of the same issue, I use mine with a miniature breadboard:

Is there a link to that breadboard type? I have found one on bitsbox that looks similar but I'm not sure if it will fit

Image

How is that a help?  These have exactly the same pin spacing as larger breadboards.

Here is a link to the above breadboard. And the spacing is different, at least when I compare it to my standard size breadboard.

I use these, and they work well.  They are available from the usual sources, and with US suppliers can be on your workbench in 3-4 days.


text:
upload real time ultrasonic sensor data to pubnub using arduino and esp8266
I want to upload the real time data of ultrasonic sensor attached to my Arduino  Uno and I have been using esp8266 module for the WiFi connection.
I want to upload to PubNub but I don't know how to start writing the code for PubNub and where do I have to write the code.
I have the code working on my Arduino using the ultrasonic sensor in C++ language, printing the readings on the serial monitor. However, the code will be definitely changed in order to upload the sensor readings to PubNub.
On PubNub the most used SDK is JavaScript and I'm not very familiar to it. For C++ the most used SDK is Posix but it seems way more difficult more than JavaScript. So how I have to translate the code from C++ to JavaScript to get it published on PubNub?
Sorry, I am completely new to this stuff therefore I don't know much about it.

The PubNub website has a link to an Arduino library:
https://github.com/pubnub/arduino
Although it doesn't have specific support for the ESP8266 per se, it does support the Arduino Ethernet Shield, Arduino Wifi Shield and Arduino Wifi101 Shield, so I would imagine it wouldn't be hard to adapt the code.
Be aware that for the Arduino Uno, the SRAM will be fairly limited, where as the  ESP8266 contains 96 KB of DRAM.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Are there any online data analysis websites for arduino IoT projects?
I am planning on making a system where multiple arduinos monitor the conditions of certain type of plant. (Each arduino monitors its own plant, but the plants are of the same species). Each plant would have a different placement in the yard(varies the light). The plants are watered as normal, without an exact amount of water. The arduinos would measure light, temperature, and soil water content. Each would send it to the cloud. My question is: Is their a cloud service that can analyze and "find" the best conditions(amount of water,light,temperature,etc) for type a plant, based on how healthy the plants are?(The health of the plants would be entered in manually by the person using the system). (Sorry if my question doesn't make sense, please ask me any questions you have ,Thanks.)

For starters, you would need to have some mechanism to send the data to the cloud since the Arduino cannot do that as standalone, WiFi or Ethernet shield. Arduino also doesn't have enough capability to interact with SQL or comparable database technology, so you would need to send the data to a PC to do the actual cloud processes.

Yes, I am aware that the arduino requires extra hardware to connect to WiFi. Why do I have to send it to a PC? Why not just send it to a cloud service which analyzes the data?(All the arduino is doing is sending data to a server)

To send data to cloud you will need an internet shield and given that the individual plants are far apart, you will need a wifi shield for each plant that you want to monitor most likely the yun shield.
Now for online services, there are a few like Temboo, Pushingbox, Initial State, Cayenne, Xively.
Each of them works differently and you will need to choose which best suit you.

Thanks for the reply. My question is kind of old so I don't remember the exact context of why I asked my question. But what I think I was trying to ask was, are there any analytics services that find trends based on data, detects patterns, etc. Since then I have seen services such as Microsoft Azure that can analyze and find trends in data. I have used Temboo before and I don't think it has analytical services or anything like that.

Temboo don't have analytics services but you can use Temboo to upload the data to Google spreadsheet and then process the data into graphs or whatever

None of these services will inherently give you an analysis, Dashboards like cayenne can help. But you would still need your business logic layer to compute which plant was in best conditions. You could also try import data into SQL tables and then into SQL CUBE to analyse the data..

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Can you pass params to an arduino sketch?
I was wondering if there is a way to pass parameters to an arduino sketch at the upload step.
Edit: The reason this would be helpful is because I have a bunch of esp8266 units that need to have details about their specific location but changing variables around per upload feels tedious.
If this is not possible the other solution that I am probably going to try is to have a sketch to just flash these details to eeprom and then read it from there whenever it is needed. Also storing them in eeprom feels a bit better than as literals in these sketches.

You might be able to do something tricky to the binary image with dd

Is there a dd equivalent for windows?

googling finds: http://www.chrysocome.net/dd

http://www.nongnu.org/avrdude/user-manual/avrdude_6.html indicates you can save separate eeprom images in addition to the code.

That might be perfect.

ESP8266 doesn't use avrdude.

Right, either way I tried the method below my edit and it worked out fine.

Every ESP8266 has a unique MAC address. You could that information to distinguish between the different units.
Something like if( mac='00:0a:95:9d:68:16' ){ ... }

Yes but I need each unit to know where it is located, I do not want to have an external lookup for its location.

You could store all the locations in an array in your code. Then use the MAC address to look up the right location from the list. The only downside is that you need to know the locations and mac-addresses ahead of time.

Another option, if you can afford the pins, is to install DIP switches or ground-jumpers on a few pins and set / wire a different n-bit code onto each board. Set those pins to INPUT_PULLUP, read them at setup, and wallah! each board is unique. You can put the lookup table (binary number -> parameter string, f/ex) in Flash so it doesn't take up scarce RAM.

To add to the above, you could use two pins with dip switches and add resisters to make a ladder. then just read the R value?

In that case you'd only need one (analog) pin.


text:
Programming an Arduino over the air using an ESP8266
This question stems from this article (Originally in Spanish/English) which Hack a Day summarizes (Includes link to partial English translation). These articles show that it is possible to update an Arduino Uno via an ESP8266 over WiFi.
I've modified the code so that when I hit the reset button on the Arduino connects to an "Update" server via the ESP8266, configured in "transparent" mode, to check for an update. If one is present the ESP8266 updates the Arduino which reboots itself. If there isn't an update I reset the ESP8266 and quickly tell it to drop any connection before it can reconnect to the "Update" server thus allowing me to connect to a "Logging" server instead for normal operation.
There is a slight difference in how one connects. The "Update" server is connected with the ESP8266 in "transparent" mode. While connecting to the "Logging" server the ESP8266 is in "normal" mode.
At present I have wired an additional connection to the reset pin of the ESP8266. Whenever it doesn't do what I want it to do I drop the power on the reset pin, confuse it and Zap in a command before it's managed to re-establish any "transparent" connection. This works but seems a little like black magic.
I was curios to know if there is a better way to force the ESP8266 out of "transparent" mode.
Note: I have not flashed the ESP8266 with NodeMCU/ESPLink or some other firmware.
Aside: There is an ESP8266 Arduino Core library does this also flash the ESP8266 in a manner similar to NodeMCU/ESPLink or does this run on the Arduino and facilitate over the air updates using the native firmware as I am trying to do ? I've only just started reading their documentation. (As this is a first post I've run out of links to share)

I think you should consider using ESP-LINK

@NccWarp9 I'll do so the next time I try this. For this project the main communication module is actually a GSM unit and I was using the ESP8266 simply for eavesdropping/debugging purposes. I am still curious to know what the proper procedure is. I've had to do something similar before and no doubt I'll have to do so again. It feels hacky to simply drop the power on the ESP and I am just curious to find a better/best practice.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Sending binary data to HTTP server
I am new to low level programming.I am trying to send binary data to the http server.At the moment i just fill up the byte array with numbers and send them to the server(eventually i want to send image file). I can see the request in the server log as
2016-05-18T23:30:26.688040+00:00 heroku[router]: at=info method=POST path="/api/users" host=myapp.herokuapp.com request_id=ed2b7852-7021-4642-a663-f9709e1aea70 fwd="99.89.114.63" dyno=web.1 connect=0ms service=2ms status=404 bytes=221
Questions
1.My question is as you can see in the log, what is bytes=221 i thought if i sent byte array of length 32 i should see 32 bytes(or around 40s).And i made the buffer of length 1024 byte array, still in the server log is bytes=221.Are my bytes are even being sent?
2.How would i handle the bytes received on the server side just to be sure client.write actually succeeded?(Just in high level...doesn't matter you can guide me in any language,Java,ruby,C,NodeJS)
Here is my code.Thank you in advance.
#include <ESP8266WiFi.h>
#define SSID "ssid"
#define PASS_SSID "password"
#define HOST "myapp.herokuapp.com"
WiFiClient client;

byte buffer[32];
int bufOffset = 0;
byte startByte = 0;
byte nextByte = 0;

void setup() {
    Serial.begin(115200);
    checkConnection();
}

void loop() {

  if (client.connect(HOST,80)) {
           Serial.begin(115200);
           Serial.println("conected to the server");
           String start_request = "";
           String end_request = "";
           start_request = start_request  + "--AaB03x" + "\n"
                                   + "Content-Disposition: form-data; name=\"picture\"; filename=\"cam.jpg\"" + "\n"
                                   + "Content-Type: image/jpeg" + "\n" + "Content-Transfer-Encoding: binary";
          end_request = end_request + "\n" + "--AaB03x--" + "\n";
          client.println("POST /api/users HTTP/1.1");
          client.println("Accept: */*");
          client.print("Content-Type: multipart/form-data; boundary=AaB03x");
          client.println(start_request);

         //Fill the buffer with values
            nextByte = startByte++;
            for(int ii = 0; ii < sizeof(buffer); ii++) {
            buffer[ii] = nextByte++;
        }

          //write it to the server
        int count = client.write(&buffer[bufOffset], sizeof(buffer));

       //end the request
       client.println(end_request);
        client.stop();
       }
      }

You should forget about MIME, that is only needed if you are sending multiple files to the server. Your best bet is to just send these headers, then a blank line, then your data:
POST /api/users HTTP/1.1
Accept: */*
Content-Type: application/octet-stream
Content-Length: 123

On the other end, you just look at "request.body" and it should have your binary data. (Replace 123 with sizeof(buffer))

Thank you BraveNewCurrency. If i send a jpeg bytes though application/octet-stream, on the other hand how hard is it to handle those bytes back to the image(what do i need to do)?Thank you again.

Er, you don't need to "do" anything, bytes are bytes.  If you prefer, you can set Content-Type to be image/jpg. I suppose it could matter if your web server is checking content-types. (I assumed you were sending to a custom server, so you were not checking the content-type.)


text:
Inherent delay running EEPROM.read()
I'm using EEPROM to store long term data for use in sketches (thanks to DarthRubik for the guidance).  I store stuff like a location ("Garden") and a device name ("Greenhouse Monitor 02") plus whatever else I'd need to store to help filter through data.
When this information is stored in the sketch itself it is recalled quickly and accurately, is passed via wifi to my PHP, that then posts the data to the relevant fields in my AWS db.  Piece o' cake!  When I store it in the EEPROM, the extra time required to find it in EEPROM, pull it through the sketch, and then push it through to the db corrupts the data sourced from EEPROM and posts a jumbled mess of characters...if it even makes it to the db at all.
My question is actually simple (I think):
Is it possible to "stage" strings from EEPROM in flash or SRAM vs. pulling cold from EEPROM?
I think PROGMEM plays a role here and I'm looking at examples oh how other sketched employ PROGMEM to better understand how to use it.
I am withholding the code for now because I want to try to implement concepts people may describe before I am just shown the solution...although that would be easier.  If I can't figure it out I'll post the code for more direct answers.

I don't play a lot with EEPROM but your description of "extra time" making the whole stuff fail, looks weird to me. I guess we are talking about a few ms here only. Have you measured that time?

No.  I haven't.  Can you point me to a sketch timer (or whatever it's called)?

I would say your assumption that 'it is slow so it is corrupting the data' is wrong. Do you know that the data is correct? Do you know that you are really storing and retrieving the right things?

I just measured it: a single call to EEPROM.read() takes about 1.8 µs (microseconds, yes, not milliseconds).

Please post the code you currently use to get your data from EEPROM. Without viewing it, it will be very hard to point you into the right direction.

I plan to post it.  I haven't gotten around to it yet.

When I store it in the EEPROM, the extra time required to find it in EEPROM, pull it through the sketch, and then push it through to the db corrupts the data sourced from EEPROM and posts a jumbled mess of characters...if it even makes it to the db at all.

Are you certain of that? It is incredibly unlikely that mere time will corrupt characters and data as they are read and sent - especially the minuscule amounts of time we are talking here.

Is it possible to "stage" strings from EEPROM in flash or SRAM vs. pulling cold from EEPROM?

Yes, and you are already doing so, since you can't send direct from EEPROM to WiFi - you have to go via SRAM. You read from EEPROM into SRAM then send from SRAM through WiFi. You just won't be doing it an entire string at once.

I think PROGMEM plays a role here and I'm looking at examples oh how other sketched employ PROGMEM to better understand how to use it.

No, it doesn't. PROGMEM is for storing strings and other data within your sketch. It has nothing at all to do with EEPROM.

I am withholding the code for now because I want to try to implement concepts people may describe before I am just shown the solution...although that would be easier. If I can't figure it out I'll post the code for more direct answers.

Without seeing your code no one is really going to be able to help you. I suspect (although I am stabbing wildly in the dark) that your EEPROM reading/writing code is completely wrong and you aren't actually storing the data you expect in the EEPROM, nor reading it back properly. Unless we see your code we can't know what is going on, and so we don't have a cat's hope in hell of diagnosing your problem.


text:
Low-byte fuse programming of ATmega328 on Arduino Uno
I want to use the ATmega328 on my Arduino Uno board to clock a TDC1000 using the clkout bit of the ATmega328, but this requires fuse programming of the low byte. Can anyone tell me how to do this?

Get a programmer and use avrdude.

Do you have another Arduino? If so, check this video and you can set the fuses with AVRDUDESS.
Be careful: if you set the fuses the wrong way you kind of "brick" the chip, and depending on the mess, you can only recover with a high voltage programmer.
One advantage is that you can never ruin the chip with the fuses, just make it hard to reset to some defaults.


text:
How do I turn off the blinking cursor/caret in the Arduino IDE?
I just purchased a RedBoard, knowing that it would work on Linux, and knowing that it could allow me to easily interface with some electronics project. I am aware of the ino command line tool but I wanted to try interfacing with my board using the Arduino IDE because the latter seems to be somewhat standard. However, when I open the IDE I see a blinking cursor and for whatever reason I can't deal with this. How do I turn off the blinking cursor in the IDE?
I've managed to fix the blinking cursor problem in Firefox, GNOME, KDE, and my terminal... just not sure what to do with Java applications like Arduino IDE.

Workaround; In the settings you can set the IDE to use a external editor. Then you can use an editor that doesn't blink the cursor.

@Gerben: Thank you. Just in case someone else reads this, it is "File > Preferences" and then I check the "Use external editor" box. You don't actually tell Arduino IDE what the external editor is, you just edit the file and the IDE will "see those changes automatically".

As suggested by Gerben, you can go into Preferences and check the box "Use external editor":

Now you can edit with your favourite editing program.
With this option active the IDE will show your sketch but in a non-editable way, and with a blue (cyan?) backwash:

Whenever you save the file in your external editor the IDE will detect the change and refresh the code shown in the internal editor.
Effectively you have replaced the IDE's editor with your own, but still use the IDE to compile and upload your sketches.

Note: does not work with version 1.6.11. Works with 1.0.6

Open the Arduino IDE
Go to File
Then go to Preferences
At the bottom of the page is the file location you can enter to set additional preferences
Exit the Arduino IDE
Go to the preferences file location then set editor.caret.blink=false
Then save
Then restart the IDE and the caret will not flash


text:
Can't store time over 9 hours and 10 minutes
I am making a clock on my Arduino Uno using the time library http://playground.arduino.cc/Code/Time
I let the user set a time. Which is then converted to seconds and used in the
setTime(s);

function.
When the value is over 9:10h, the seconds evaluate to 4 294 941 360 seconds (=
1 193 039.27 hours)
A code snippet:
void timeChange() {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Change time");
  lcd.setCursor(0, 1);
  lcd.print("00:00");
  int hoursSet    = 0; //Stores the hours added.
  int minutesSet  = 0; //Stores the minutes added.
  String printTime;
  bool timeComplete = false;
  while (!timeComplete) {
    int buttonVal = analogRead(A0);
    if (buttonVal >= 490 && buttonVal <= 520) { //Indicates button 3 is pressed. It's function is to add one hour to the time.
      hoursSet = (hoursSet + 1) % 24; //Adds one hour to the hours.
      delay(100);
    } else if (buttonVal >= 5 && buttonVal <= 10) { //Indicates button 4 is pressed. It's function si to add 5 minutes to the time.
      minutesSet = (minutesSet + 5) % 60; //Adds minutes to the minutes.
      delay(100);
    }

    lcd.setCursor(0,1);
    String strHr = String(hoursSet);
    String strMn = String(minutesSet);
    if(strHr.length() == 2){
      lcd.print(hoursSet);
    } else if(strHr.length() == 1) {
      lcd.print("0");
      lcd.setCursor(1, 1);
      lcd.print(hoursSet);
    }

    lcd.setCursor(2,1);
    lcd.print(":");
    lcd.setCursor(3,1);
    if(strMn.length() == 2){
      lcd.print(minutesSet);
    } else if(strMn.length() == 1) {
      lcd.print("0");
      lcd.setCursor(4, 1);
      lcd.print(minutesSet);
    }
    delay(100);

    if (buttonVal >= 990 && buttonVal <= 1010) { //if button 2 is pressed again, the timecomeplete is set to true, and the script continues.
      timeIsSet = true;
      timeComplete = true;
    }
  }
  lcd.clear(); //Clear the screen
  lcd.setCursor(0, 0);
  lcd.print("The time"); //Print text, move cursor and print the time
  lcd.setCursor(0, 1);
  String strHr = String(hoursSet);
  String strMn = String(minutesSet);
  if(strHr.length() == 2){
    lcd.print(hoursSet);
  } else if(strHr.length() == 1) {
    lcd.print("0");
    lcd.setCursor(1, 1);
    lcd.print(hoursSet);
  }
  lcd.setCursor(2,1);
  lcd.print(":");
  lcd.setCursor(3,1);
  if(strMn.length() == 2){
    lcd.print(minutesSet);
  } else if(strMn.length() == 1) {
    lcd.print("0");
    lcd.setCursor(4, 1);
    lcd.print(minutesSet);
  }
  lcd.print(" is saved!");
  setTime((hoursSet * 3600) + (minutesSet * 60));
  timeIsSet = true;
  delay(5000); //Wait five, seconds then proceed

}
Added this to the code:
      Serial.print("hours ");
  Serial.println(hoursSet);
  Serial.print("hours in s ");
  Serial.println(hoursSet * 3600);
  Serial.print("minutes ");
  Serial.println(minutesSet);
  Serial.print("minutes in s ");
  Serial.println(minutesSet * 60);
  Serial.print("Combined:  ");
  Serial.println( (hoursSet * 3600) + (minutesSet * 60) );

When I input 5:15 it results in:

hours 5
  hours in s 18000
  minutes 15
  minutes in s 900
  Combined:  18900

When I input 9:15 it results in:

hours 9
  hours in s 32400
  minutes 15
  minutes in s 900
  Combined:  -32236

So, it looks like the library only holds an Int. But that seems odd, as the function expects seconds.

And now you know why no one does that.

Well, this is a school project due tomorrow. So I can't do much with this...

What IDE version are you using, that page you've referenced specifically states it doesn't work with 1.61

Here's a hint: 32767 seconds is 9 hours, 6 minutes and 7 seconds.
What is the largest value that an int can hold?

EDIT: I can't add comments on this computer (old browser), so I have to respond to your question here.
time_t is an unsigned 32-bit value, but all of your input values are signed 16-bit values. When you take a product like 3600*10, you get a bit pattern of 1000110010100000, which is 36000 when interpreted as an unsigned value, but is -29536 when interpreted as a signed value.
When assigned to a time_t, the value is sign-extended to 32 bits, which makes it 11111111111111111000110010100000, which is 4294937760 when interpreted as an unsigned value.
If you want to write a statement like
time_t x = (hoursSet * 3600) + (minutesSet * 60);

you need to type-cast your input arguments to the correct type first:
time_t x = ((time_t)hoursSet * 3600) + ((time_t)minutesSet * 60);

Well, I know that is. But as it is a function "setTime" Which expects a second input for the time. And also would take a date like that.

Can I edit the function so that it takes unsigned long?

time_t x = (hoursSet * 3600) + (minutesSet * 60);
Serial.println(x);
  setTime(x);

When I try it like that, it returns Combined:  4294937760 (For 10:00)

Changing this:
  time_t x = (hoursSet * 3600) + (minutesSet * 60);

To this:
  time_t x = ((unsigned long)hoursSet * 3600) + (minutesSet * 60);

Has solved the problem


text:
Trying to print text on LCD display from Arduino trinket
I'm trying to simply program an Arduino trinket to display some text on an LCD display.
I'm basically trying to follow this, except connect it to a Trinket rather than an Arduino Uno. The background color of the LCD display is changing as expected from the loop function in my Arduino code, but it's just displaying some o's and arrow's for text on the LCD display.
I'm new to Arduino's (and EE in general), but am a computer programmer.
What am I doing wrong that the sample code in the above link doesn't print text on my LCD display?

If the code partially works (screen is cleared and starts to print) are you sure your closing syntax (; }) and delimiters are in place? If the BG 'for' loop is working, what is blocking the rest of the code? One tiny syntax error will do that.

Since you mention the target board is an "Arduino Trinket" instead of "Arduino Uno", could there be some difference in how the LCD display was wired? In other words the pin assignments may be different than expected in the example code. As a diagnostic you could try the LCD Hello World example (under File - Examples - LiquidCrystal - HelloWorld if you're using the Arduino IDE). If that doesn't work then you need to find the schematic for your board, determine which LCD pin connects to which ATmega328 pin, and then which "Arduino" pin number that is, so you can update the source code.

Disregard my above comment; I misinterpreted the question; usually Arduino + LCD means an HD44780 LCD connected directly to the ATmega328. That's not the case here. You actually have a serial (RS232-like) connection between two devices. So the real problem is more likely incorrect baud rate, or some other RS232 protocol related issue.

Looking at the first photo, was there some reason you connected the white serial data wire to the trinket's "Digital #0" instead of "Digital #2" as in the example code? Be aware that on Arduino UNO, digital #0 is used for serial receive, so may cause problems to use that pin for a serial transmit. It looks like Digital #2 is not currently used on your board.

Finally tracked down what Arduino Trinket is: ATtiny85 not ATmega328 - very different beast. Your linked example code uses SoftwareSerial (ATtiny85 has no hardware serial). Are you sure you have the correct flag settings? If the ATtiny85 was set to internal 1MHz clock instead of internal 8MHz clock, baud rate will be wrong. I'm not even sure if internal clock is stable enough to support serial comms. If the "trinket" has a external clock oscillator, make sure the ATtiny85 flags are correctly configured to use it. Try to wrangle an oscilloscope to verify the serial comms timing.

@MarkU The reason I used #0 is b/c I had already tried using #1 and #2 and i didn't know if there was a difference between the pins.

How would i check the flag settings? Also I'm pretty sure I tried the Hello World example and it didn't work.

The liquid crystal hello world example code does not work.

You could try this tutorial first to verify that you can get Serial working. Then add LCD. https://learn.adafruit.com/trinket-bluetooth-alarm-system/code. Use the software serial section to debug your trinket communication.

Operating this display should not be out of the range of the ATTiny85 abilities. I have one using a two-way serial connection for a setup routine, that modifies EEPROM values.

First off connect to the LCD Backpack using the USB connector and test it through there to rule out it being faulty.
At the bottom of that page:

For more commands, check the github repository (see the Downloads tab) for a python script that will test all commands on the display.

Testing Trinket Serial:
What you can do is take your trinket and run a basic Serial connection program to test if the Trinket is sending the right info out.
Trinket:
#include <SoftwareSerial.h>
// Create a software serial port!
SoftwareSerial comm = SoftwareSerial(0, 1); //RX,TX
#define LEDPIN  PINB2
void setup() {
  //set baud
  comm.begin(9600);
  DDRB |= (1 << LEDPIN);  // set LED pin to output mode
}

void loop() {
  //print a specific character once a second

  comm.println('a');
  PORTB |= (1 << LEDPIN); // turn on LED
  delay(500);            // 0.5 second delay
  PORTB &= ~(1 << LEDPIN); // turn off LED
  delay(1000);
}

Then you need another Arduino, like an Uno, Leonardo:
// For leonardo use Serial1 for the connection to trinket
void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Serial.println("Ready...");

  // set the data rate for the SoftwareSerial port
  Serial1.begin(9600);
}

void loop() { // run over and over
  if (Serial1.available()) {
    char incoming = Serial.read();
    Serial.println(incoming);
  }

}

Or the stock balnk sketch and connect the Trinket Serial out to Arduino TX-> 1.
If using an UNO you can set up a SoftwareSerial style of the above.
I recommend this rather, a USB-Serial converter as it will be quicker and cleaner.
Next you need to see what is coming out. If the received data is correct then there is an issue in the LCD display, try re-flashing the LCD board with new firmware.
If the data comes through correctly then move onto using the Adafruit  code and still connecting it to the other Arduino boards serial connection, replacing the Serial.println(Serial1.read()); with Serial.println(Serial1.read(),HEX);.
If the data still comes through correctly then the data is not being received properly by the LCD backpack.

LCD Backpack
You should test the display board with another Arduino, UNO or Leonardo (32u4).
Run the Adafruit tutorial code and see the results. If the code works then there is a problem with the Trinket and the SoftwareSerial library.
If there are again errors that happen with the LCD backpack when used with a 'normal' Arduino then it is the problem.

Recomendations
Download the ATTiny core from High-Low Tech and burn the 'bootloader' to reset the fuses to 8MHZ setting, also this is a good core to use if you want more space on the ATTiny.
Possibly re-flash the trinket bootloader and make sure the internal clock is 8MHz; the SoftwareSerial library is touchie I believe.

Warning: I do not have a ATtiny85 nor the lcd so this is purely based on what I found after some reading up on this mcu.
What I would do in your situation:
As the trinket is using a ATtiny85 it does not have hardware serial. So a software variant is needed.
You opted for software serial (which is the most obvous in Arduino world) but which seems to be the hardest solution.
According to this source Serial communication with the Tiny's is is possible (And I quote)

you might have to tune the internal oscillator to get a stable
  connection.

Assuming your lcd does not need to send data back; I would try the TinyDebugSerial.

Bear in mind that adding an external crystal would be the easiest/most reliable. But this will cost you 2 specific I/O pins.
There might also be memory issues, since the ATTiny85 has a lot less memory as the ATMega328.
The Arduino Nano (or pro micro) might fit your physical size requirements, while being a lot more "powerfull".


text:
Range of Offset Value in pH sensor module?
In finding the pH value of a liquid/Soil, what is the range of Offset voltage value that I can use in my code?
Using / calibrating pH sensor module
I considered the above link as a reference. But I didn't come to know the range of Offset Value...
Here is the logic below to find the value of pH right...
avgValue = 0;
for (int i=2;i<8;i++)       // take the average value of 6 center sample
avgValue+=buf[i];

float phValue = (float)avgValue*5.0/1024/6; // convert the analog into millivolt
phValue=3.5*phValue+Offset;

What is the range of Offset value can I use in the above/my code?
Thanks in Advance

I think you would need to test it by testing known value solutions with your sensor.  It is probably going to be different between different instances of the sensor so each will need calibrating in this way.

I tested it for water of pH 7.0. It's showing a value of 10.5 units. So, I considered -3.5v as an offset value..While considering offset value as -3.5v, I got a doubt that is there any limited range for an offset value to consider

It is doubtful any ADC / sensor combination is exactly linear, of the correct magnitude, slope and w/o noise.  How precise / accurate your application needs to be should dictate your efforts.  My next steps would be to plot know acid and bases to resolve these questions.

I don't think you mean -3.5v, because the voltage range you are measuring is 0-5v.   At the moment all you know is when the variable phValue = 10.5 then the pH of the liquid is 7.0.  Like st2000 says you now need to pad out your calibration table  what does pH 1 make your device read?  pH = 2 ? etc.  Then you will get a table that says when the sensor reads 3.9 it means pH = 1, when it read 5.2 it means pH=2, when it reads 4.9 it means about pH 1.8.

Something you may also want to consider is what happens if one reading is massively different to the other 5 readings.  It probably indicates a sensor fault for that reading, but it will move your answer towards pH=1.
I don't think you should be dividing by 1024.  This division will loose some precision in your reading and therefore it will make you calibration table less accurate.

After doing a lot of Calibrations, I used offset value as -4.0, For Solution of pH 7, its showing the value same as 7.0.. for pH solution of 4.0, its showing 5.2(4.0+1.2)... for pH solution 10, its showing 8.8(10-1.2).. To get correct values for pH solutions of 4 and 10, What I need to do?

When converting real world sensor measurements into usable data there are several issues to consider:

Noise from any number of sources such as (unavoidable?) long cables and power supplies to name two.  Consider using exponential averaging to minimize the effects of noise.  If the noise if predictable consider sampling only when the noise is absent.
Slope of the data is important when converting to known scales.  For example the slop of the resistance of a thermistor verses heat may not have the same slope as the temperature in Celsius verses heat.  Simply multiply by the appropriate constant to correct for slope error.
After you correct for slope the values may still not be correct.  When all values are equally less or more then the expected values an offset is required.  Simply add or subtract the appropriate constant to correct for offset error.
Linearity is often corrected using lookup tables.  Linearity is a measure of how closely the sensor tracks the physical value being measured.  For example, after slope and offset corrections, a thermistor measurement may appeared curved when compared to the actual temperature in Celsius.  For this final correction the sensor measured value is used to index into a lookup table which returns a correction value.  Interpolation is used to control the size of the lookup table when space is a consideration.


text:
IO Control and Configuration
I am using Eclipse to program a ATMega2560 and would like to stay away from the Arduino library, While looking through AVR Examples I have seen the syntax
#include <avr/io.h>

PORTD.0 = 1

or

PORTD.DIR = 1;

instead of
PORTD = 0b11111111;

To define and control the Inputs/Outputs when I try to use this syntax I get compiler errors:
error: request for member 'DIR' in '*34u', which is of non-class type 'volatile uint8_t {aka volatile unsigned char}'

I am sure that I am simply missing a include file or something but I can't figure out what I am doing wrong.

Where did you find the example code? That is not valid syntax for the AVR io definitions. Looks like PIC.

@MikaelPatel I have seen this quite a few times while searching for AVR, here is one site http://www.elecrom.com/2008/02/12/avr-tutorial-2-avr-input-output/

That is (as below) for another compiler (CodeVisionAVR) and not AVR-GCC which is used for the Arduino IDE. I guess that something similar (e.g. PORT[0]) could be defined in C++ using a class for Ports and an index operator. The dot operator (or struct) would have to be symbols (e.g. PORT.bit0). You could have a look at Cosa, https://github.com/mikaelpatel/Cosa.

What you're doing wrong is that you're using the wrong compiler. That syntax is for CodeVision or mikroC, but the Arduino IDE uses GCC. Which follows global standards rather than making syntax up.

Holy cow! Alright I see, I thought CodeVision was an IDE or something. Too bad, that's a nice way of doing it.


text:
Getting Firmata to control WS2801 LEDs
I am trying to control a strip of WS2801 LEDs through an arduino uno running firmata from Python on my laptop.
I've written some basic code based on adafruit's library here (from line 187):
from pymata_aio.pymata3 import PyMata3
from pymata_aio.constants import Constants
import time

leds = [(255, 255, 0), (255, 255, 0), (0, 255, 255)]

uno = PyMata3()

uno.set_pin_mode(2, Constants.OUTPUT)  # signal
uno.set_pin_mode(3, Constants.OUTPUT)  # clock

def show(leds):
    for pixel in leds:
        for channel in pixel:
            i = 0b1
            for x in range(0,8):
                if i & channel:
                    uno.digital_write(2, 1)
                else:
                    uno.digital_write(2, 0)
                uno.digital_write(3, 1)
                uno.digital_write(3, 0)

                i = i << 1

    uno.digital_write(3, 0)
    time.sleep(0.001)

When I run the code it seems to run ok, but only the first LED will light up. I think (too quick to be certain) that it flashes through all the colours - ie displaying each colour rather than passing them through.
I'm wondering if there is something wrong with the timing for the clock pin making it latch, but I'm grasping here.

You cannot do precise timing of I/O mediated by USB like that. Regardless of the serial baud rate in use, the USB mode utilized basically puts a 1ms minimum interval between any two distinct communication operations.
Providing there are no intervening reads, if firmata is coded to deliver its data to the host's serial API in buffers matching or exceeding the USB packet size rather than individual writes for each command, it is possible that "keeping the pipe full" may mean that commands are able to be executed without such gaps, but any little interruption could introduce a problematic delay.
The key problem with delay is this part of the data sheet:

CLK pin keeps low more than 500uS will make the WS2801 internal status register reset, and at this moment, the gray scale data
  in the data shift registers will be latched.

Basically, that says that you need a clock low pulse of more than a half millisecond to start the process, but by extension it also means that all of the subsequent clock pulses have to be shorter than that or you will inadvertently reset the process, and this is not something you can easily achieve reliability of with a USB bus of the type utilized here mediating your software manipulation of the clock line.
Essentially, don't try to bit-bang things with Firmata.  You should send the desired intensity values across the USB as byte data, and then have software running on the Uno clock this data out in accordance with the WS2801 timing requirements.
Personally, I'd just write that as an ordinary sketch reading the Serial input - no need for firmata.  You can still feed the data from python on the host if you like, or anything else that can push data over a serial port.

Thanks, that's great.
I thought that would probably be the case, and I'd already thought I might have to make my own protocol for controlling the LEDs.
I'm very new to programming, so its great to have my instincts confirmed.

I'd offer you my protocol but it's designed to be used over raw USB rather than a serial connection.

Yes, raw USB can actually make things simpler as you can use the start of each packet as an alignment marker.  With a plain serial port, you have to come up with some sort of in-band (or long-timeout) synchronization method, reserved code with escapes, or just escape everything by encoding it in readable hex, and use newlines...

@IgnacioVazquez-Abrams , that would be really useful. I'm kinda fumbling my way through this (and really enjoying it when I'm not frustrated and angry at it). So any help would be fantastic.

@angusprune: I don't actually have the protocol formally documented anywhere, but here's the Python script that I use to control the device.USB_SET_LED_COUNT tells the device to allocate an internal buffer to hold the LED colors. USB_SET_LED_RGB takes an index and color and sets a buffer entry. USB_UPDATE_LEDS tells the device to transfer the colors from the buffer to the LEDs.

Hmm, I'm not sure I'd use individual control writes for that, but then when I looked at this it was for pumping constant data to the maximum number of LEDs the string protocol could support.  The bigger issue for angusprune will be that USB provides a built-in "this is a start of a new message" indication which serial lacks when carrying binary data.  Though if the update rate is slow, sending things in a textual format such as [LED]=[VALUE]\n could work.  Ironically if these are handed off to the serial API in large buffers they might be faster than USB control transfers.

It's possible that time.sleep is causing a latching issue. You should instead use pymata-aio's sleep function:
uno.sleep(0.001)

The documentation for it can be found here: http://htmlpreview.github.io/?https://github.com/MrYsLab/pymata-aio/blob/master/documentation/html/pymata_aio.html#module-pymata_aio.pymata3
You could also try a different pin and see if you still have the issue?

I think Chris' answer hits the nail on the head. I'll have a go at writing a protocol to transfer the data rather than bit banging directly.


text:
How to write IF/Else using a threshold range of values
basically I am trying to write an IF/ELSE statement that triggers a light when a pressure sensor is between two values.
In other words, I want the light to respond ONLY if the analog read is between 400 and 600, as opposed to, say, only being above 400.
Here is the code, any suggestions?
int sensor=0;
int threshold=200;

void setup (){
  pinMode(2, OUTPUT);
  digitalWrite(2, LOW);
  Serial.begin(9600);
}

void loop() {
  sensor=analogRead(0);
  Serial.println(sensor);
  if (sensor > threshold) {
    digitalWrite(2, HIGH);
  }
  else {
    digitalWrite(2, LOW);
  }
}

To get the light to turn on only when the sensor reading is between two numbers, you should test if the reading is between the two numbers, and if it is, turn on the light.
To test if a value is between two numbers, you could use the && AND operator to see if both conditions are met.  For example:
if (sensor > loLimit && sensor < hiLimit) {
    digitalWrite(2, HIGH);
} else {
    digitalWrite(2, LOW);
}

Here's a shorter way to write that:
digitalWrite(2, (sensor > loLimit && sensor < hiLimit));

In this form, the expression evaluates to 1, or HIGH, if it is true, and to 0, or LOW, if it is false.
Another approach is to test if abs(sensor-midLimit) < halfGap, where midLimit is (loLimit+hiLimit)/2 and halfGap is (hiLimit-loLimit)/2.  Turn on the light if abs(sensor-midLimit) < halfGap, else turn it off.


text:
Question about number of sensors for Arduino Mega
What is a good max number of sensors for an Arduino Mega? Since it has like -- 2? -- ground connections, is it better to keep the number of sensors to a minimum amount?

It depends on what you want the Arduino to do with them. There is no (not much) penalty for having many sensors connected. Where it begins to matter is when you need to read at rates which, collectively, tax the speed of the processor to meet the total demand. Your project specs will really determine how many sensors make sense. The other place that sensor count might matter is if your project is to be battery powered, and the sensors draw some amount of current even when they're not being used. In a battery powered project, you'll want to be able to power-down everything that isn't being used at a given time, to maximize the system's overall run-time on battery.
The Mega, and I'm assuming you mean Mega 2560, has 50-some odd I/O pins available, so you have a lot of potential connectivity, and I think it's safe to say, the designers intended for them to be used.


text:
Arduino Wifi/Wemos Wifi D1 adding &t=0 to simple GET request
I'm attempting to make a simple get request to my website from my arduino, but I'm unable to do so.
I keep getting the following error:
<html>
  <head>
    <meta http-equiv="refresh" content="0;url=http://dnserrorassist.att.net/search/?q=http://www.example.com/&t=0"/>
  </head>
  <body>
    <script>
      window.location="http://dnserrorassist.att.net/search/?q="+escape(window.location)+"&r="+escape(document.referrer)+"&t=0";
    </script>
  </body>
</html>`

Edit: Here's the important code.
const char http_site[] = "www.example.com";
const int http_port = 80;

// Perform an HTTP GET request to a remote page
bool getPage() {

  // Attempt to make a connection to the remote server
  if ( !client.connect('http://' + http_site, http_port) ) {
    return false;
  } else
  {
    Serial.println("Connected!");
  }

  // Make an HTTP GET request
  client.print("GET /");
  Serial.print("GET /");

  client.println(" HTTP/1.1");
  Serial.println(" HTTP/1.1");

  client.println("Host: xxx.xxx.xxx.xxx:1995");
  Serial.println("Host: xxx.xxx.xxx.xxx:1995");

  client.println("Connection: close\r\n");
  Serial.println("Connection: close\r\n");

  return true;
}

void loop(void){

  if ( client.available() ) {
    char c = client.read();
    Serial.print(c);
  }
}

That doesn't look like an error to me. Can you give more detail? What is your code?

That's very true. It looks like a URL parameter is being added, but I'm not adding it anywhere.

It may not like the IP address in the "Host:" line. See 3.2.2 http URL

Hey, I figured it out. It didn't like two things: 1. the IP in the Host, and 2. http:// in the client.connect.

client.println("Host: xxx.xxx.xxx.xxx:1995") sounds wrong to me. It should be either client.println("Host: xxx.xxx.xxx.xxx") or better client.println("Host: www.example.com")

@Gerben, yes. You're right. I had to change that to the host I was calling. I've never worked with this stuff before, so it's been quite the learning experience :)

Did that fix your problem?

what ide do you use? is that in arduino ide?

Yes, I'm using the Arduino IDE.


text:
No Response to AT commands
I'm unable to communicate with my nodemcu ESP8266 module using the AT commands. The module does not return 'ready'  on the serial monitor and entering AT commands has no effect at all. I am able to upload programs onto the module and even receive messages onto the serial monitor. But not for the AT commands.  Please help....

Does your nodemcu have a mini USB port? Then you can actually program it directly through the Arduino IDE. This way you don't even need an Arduino. You'll only need the board files for your nodemcu board.

Or you can choose to use it and flash a program that interprets AT commands itself.

It does have a micro USB port and yeah, I can upload arduino programs onto the board. But again, I'll be needing the AT commands to change stuff like passwords and all which I guess cannot be done through the arduino IDE.  And regarding flashing of a program, could you please elaborate how it can be done? Thank you.

AT commands require the installation of firmware that responds to AT commands.
A plain ESP module normally comes with that firmware installed. A nodemcu doesn't. A nodemcu comes with Lua installed instead.

I'm using the arduino IDE. I had downloaded the ESP8266 library within the IDE from the preferences.  So will I have to install the firmware separately again?

Yes. The AI Thinker AT firmware. It's a completely separate thing that is normally preinstalled.

The bare chip knows nothing, just as an Arduino would. The AT+ command set is provided by an interpreter running on the 8266 processor. The AI Thinker modules and others, come with that interpreter already loaded. Your module does not have it installed. And any time you load a program into it, the previous one is over-written.
You can find the AT+ interpreter available for download and upload it to the module, after which it will be able to execute AT+... commands.

Use the NodeMCU to process your logic, instead of the Arduino
When using the NodeMCU (or NodeMcLua) you (in a lot of cases) don't really need an Arduino. The ESP8266-12E based "dev boards" with mini-usb connector can be programmed just like an Arduino, using the Arduino IDE.
Why?

The ESP8266-12 is powerfull enough (32-bit 80mhz)
The ESP8266-12 has (usually) enough I/O pins (and you can use an I/O expander if needed)
Adding an Arduino to it is only making the system more expensive.
Adding an Arduino to it is only making the system more complex (and needs additional wiring).

This is especially true for the ESP8266-12 nodemcu boards with mini-USB, since they're "almost" as easy to program as the Arduino.
Configuring the board file
You'll need to be able to select the "ESP8266" as your target, the Arduino IDE has a possibility to use board files for other targets than Arduino. This is best explained on tutorials and other sources online:

Install Arduino 1.6.8 from the Arduino website.
Start Arduino and open Preferences window.
Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.
Open Boards Manager from Tools > Board menu and install esp8266 platform (and don't forget to select your ESP8266 board from Tools > Board menu after installation).

Sources:
https://github.com/esp8266/Arduino
https://learn.sparkfun.com/tutorials/esp8266-thing-hookup-guide/installing-the-esp8266-arduino-addon
Limitations
When using the ESP8266, you obviously can't use any of the specific hardware features that you could normally use with the Atmega based Arduino's. However, SPI, I2C, UART, analog and digital pins should be ported rather well, and can be used. You are not able to call Atmega328 registers directly (but you may, I believe, call registers of the ESP8266 directly).

Note on the boards.txt not listing your specific ESP8266
You may find that the boards.txt does not list your specific ESP8266 or that it simply doesn't upload (can cause various errors).
Note on Chinese boards with CH340G usb-serial chip
The Chinese boards often come with a CH340G chip, these usb<->uart chips are used to interface the MCU with the PC (over USB, while acting as an USB-COM device).
These drivers for these CH340x chips aren't installed in Windows/Mac on default, you'll have to instal the drivers manually. It can be a little frustrating since these drivers usually aren't signed.

Have you tried connecting the ESP8266 to 5 V?
Some Arduino Uno boards have 2 V output for 3.3 V pin and have 3.3 V output for 5 V pin. 5 V pin can provide more current than 3.3 V pin. I have tried 3.3 V pin and it doesn't work due to lack of current. When I connect it to 5 V pin, it works.

It is always best to check the voltages with a multimeter first, else you could end up frying the ESP8266, if the 5 V does actually supply 5 V.

authors: Андрей Тернити


text:
GPS timestamping of digitized voltages from geophones
I wonder if anyone has written a code for GPS time stamping of voltages from seismic geophone (or any other sensors) digitized by internal or better external ADC connected to Arduino? Since the accuracy of at least 1 millisecond is required I believe using 1 PPS signal of the GPS is the only solution.

What's your application?  There have been questions from... ahem... other people asking how to locate an elephant using this technique.

I am sorry for being vague. The application is to read acceleration or any other vibration monitoring sensor data in three components which has analog output in terms of voltage. The voltage readings need to be digitized and accurately time stamped and stored on microsd card. For now I am concentrated on millisecond accuracy of data stored. The next phase is to use external ADC since Arduino built in ADC has only 10 bits of resolution.

To tackle the time resolution and accuracy issue you could:

Attach the 1PPS signal to an interrupt pin
In the interrupt routine record the millis() value at the time the 1PPS signal is activated
In the main loop do a non-blocking read of the GPS data to find and build up the time string as it is sent from the GPS (shortly after the 1PPS is triggered).

You now know what the millis() count was the last time a 1PPS pulse arrived, and you know the current time to within a second. The 1PPS pulse will be at HH:MM:SS.000 (or as near as damnit) so if you subtract the current millis() from your recorded 1PPS millis() value it gives you the number of milliseconds since the 1PPS pulse. Add that to the current time, and you have 1ms accuracy in the time: HH:MM:SS.iii.

The OP could probably use micros() instead of millis().  Along with using an Input Capture pin for the PPS, he should be able to get sub-millisecond resolution.
And for a non-blocking GPS library, you can't get any better than NeoGPS.  It's smaller and faster than anything else out there.

I doubt anyone has written software for your exact situation but you should be able to cobble something together if we break down the problem.

You want to read a value from an Analog port (or external ADC)
You want to read the time from a GPS.
You want to write these two readings to 'somewhere'.

Looking at the Arduino IDE tutorials there are some Analog ones that would be relevant.  But the only line you need is int sensorValue = analogRead(analogInPin); which reads a value between 0 and 1024 which relates to the output range of your sensor.
Now you want to read from a GPS, looking at the Software Serial Library Examples there is an example of how to setup a second serial port to read the GPS data. The GPS data will arrive once every 2 seconds.  The PPS signal will arrive once every 1 second.  So I'm not sure how you are going to use this to get millisecond accuracy.  To get millisecond accuracy I would use the GPS data to correct a Real Time Clock connected over either the I2C or SPI bus.  There are lots of example programs on reading from an RTC over these busses.
Write them to somewhere, well initially I would write them to the hardware serial port, back to you PC via USB, but then you might want to start looking at writing them to a SD card or via WIFI or GSM to a cloud storage solution.
Here are a list of the examples I looked at:
https://www.arduino.cc/en/Tutorial/AnalogInOutSerial#
https://www.arduino.cc/en/Tutorial/SoftwareSerialExample#
https://www.arduino.cc/en/Tutorial/Datalogger
Hope that helps

I would not recommend SoftwareSerial for this particular application, because it blocks interrupts for an entire character time, about 1ms.  For more information, checkout the AltSoftSerial home page.  AltSoftSerial is the best software serial library, if the required pins are available (depends on which Arduino you're using).  A library I maintain, NeoSWSerial, is the next best choice, and it works on any two pins.

Thank you so much for your reply. This comment also applies to Majenko who answered my question promptly. Since I got your response I have had the help of an able and enthusiastic engineer colleague who wrote a code for using Adafruit GPS logger connected to Arduino Lenonado. The link to the code is: https://github.com/Zapalot/SynchronousSdLogger. The problem is that some data points are lost and my colleague believes it has to do with low SRAM of Leonardo. I will appreciate your opinion on this.


text:
Use doorbell output (12VDC) to power arduino?
Not sure if this is possible, but could I use my existing doorbell setup to power an Arduino? I'd also like to preserve the existing chime's functionality either through the existing button or triggering it through the arduino.
My doorbell chime is made by Nicor and its input is 120VAC, but outputs 12VDC. This seems to be a very unconventional setup, but I've confirmed its output with a multimeter (it's also printed on the chime itself). The chime is very similar to this: http://www.amazon.com/Nicor-18888-Door-Chimes/dp/B006T38PTU (only difference I can see is the output). The 12V line runs to my front door where it's connected to a light up button. Here is a picture of the button's circuitry: https://i.stack.imgur.com/YsSu0.jpg
What I'd like to do is use the chime's 12VDC output to power the arduino so I don't have to rely on another power source or batteries. I will be adding smart features to the doorbell via the arduino, but my main hangup is getting power to the arduino. I've tried connecting the doorbell wires to VIN and ground, which successfully powers on the Arduino, but it also triggers the chime. It appears closing the circuit triggers the chime to play.
Is this possible to do?

Connecting 12v to an Arduino's VCC pin would likely destroy it.  You want the Vin pin.  But you also don't want to be in series with the buzzer - the voltage drop from that second mistake might be the only reason your Arduino still functions.

Sorry, I actually meant the VIN pin.

The button board looks amazingly complex for "just a button". As others have noted, it may just carry signal-level voltage, not enough to power the Arduino. Plus, if pressing the button closes a circuit, the +12V might disappear at the exact time when you want it - when you want to hear a chime.

This seemingly simple task is actually quite complicated; a good challenge that's not impossible or easy to overcome.
The AC/DC transformer in your link only provides "12VDC/6mA"; not enough to run the Arduino, chime, and button LED; so it likely needs upgraded to something beefier; you can't have too many amps on such a transformer.
Then there's your chime, which could use a lot of current (buzzer/bell) or a little bit (speaker-based chime tones). If it uses a lot, you should replace it to simplify the other connections. Remember that power goes through the chime to get to the button; otherwise the circuit would be incomplete and the ringer's LED would be dark.
The chime is activated by the resistance of the button lowering itself to the point where the chime gets enough power, no longer being current-limited by the diode, 2.2k resistor, and small LED. Very simple design, but not ideal for easily intercepting.
So what's the easiest way to accomplish your task?
Looking at it closely, it seems the basic circuit is there for you already; you have a power-consuming node on the network in the form of the button's LED.
You need to replace/augment the LED on the ringer with the Arduino. The 2.2k R19 could/should be replaced with the Arduino as well; just make sure your LED isn't over-drawn when the Arduino is chugging at full-steam, and add additional inline resistance as needed to keep it safe.
The other problem is powering the MCU while ringing. You'll notice the LED goes out while ringing. While that's nice feedback to the user, it's not because the circuit designers were UX-focused, it's because the chime's simple circuit  pulls all the current out from under the LED, just as it will an MCU in the same slot.
You can get around this using a super capacitor. I would use an LM7805 in front of the Uno to deliver VIN +5 V instead of 12 V. Then you can "short" the Uno's GND to VIN with a 1 F 5.5 V capacitor ("F", NOT "uF"). Those caps are (amazingly) available for just a few dollars on eBay.
So, at the end of the day, you basically just need to "upgrade the LED" and maybe upgrade the transformer. You could also re-create the switching pattern on your ringer with diodes if you're handy with circuit design, but if i were you, i would just "bodge" a few wires onto the existing PCB, and possibly alter that resistor.
Good luck; sounds like a fun project and a good challenge.
EDIT:
I realized you might not need any circuit mods at all; a hall-effect current sensor anywhere the line, or just paralleling the chime terminals with a voltage-divider input to the Uno might suffice, if you didn't need the MCU physically at the button. Heck, a microphone sensor taped inside the chime could accomplish the task of detecting doorbell rings...

You need to find the transformer for your doorbell system and take the power from there. It seems like somehow you are using the signal wires for the door bell instead of the power wires.
The door bell transformer should/could be in a utility room, closet, by your heating and air unit. once you find that look at the output of the transformer. I know some are AC 12 volts, and I feel like that arduino will not like that...

The transformer is part of the chime and it's connected to mains power. The chime takes 120VAC in and outputs 12VDC. If you take a look at the amazon listing (http://www.amazon.com/Nicor-18888-Door-Chimes/dp/B006T38PTU), you can kind of see what the wiring looks like (see the other images).

So get a little 12Volt or 9volt transformer and wire it into the mains at the door chime. I bet you have one laying around the house!

But the problem is that I am unable to run additional wires so I'd like to use what's already there

I understood that you were putting the arduino by the door chime, if so You wouldn't be running any extra wires.

Sorry, I'd actually like to have it by the button

The problem with putting your Arduino across the button circuit (if this is a conventional bell and button) is that the Arduino will be powered off during the button press. That may not be ideal....

Hmm, Put a capacitor and diode isolate the arduino and cap, the capacitor will keep the arduino on for the brief second the connection is broken?

Even ignoring the button press for now, how could I power the arduino without triggering the chime?

Now that I think about it, The 12volt you are getting at the chime is a signal wire, probably carries very low current. I feel like the doorbell is a NC or normally closed switch. When its pressed it breaks the circuit telling the chime to chime, when hooking the arduino up the chime detects a voltage drop and triggers the chime... although the chime is sending power to light the doorbell...? It's hard telling with out being able to look at it and try somethings.
When you hook the arduino up is the chime ringing constantly or something?
If it just does it once, whats the issue?

The chime is actually triggered constantly when hooked up to the arduino, which is why that hasn't worked for me.

You want the Arduino at the bell itself? Sorry but I don't see any way. Either run power to this area, or relocate the Arduino to where there IS sufficient power (and once you do that, think about why you wanted the Arduino "at" the the actual button, so you can consider possible solutions).

If your extra features only need to sense the button press, then your arduino can go at the chime and use the 12V source that also powers the chime.
You put an opti-isolator's led side in series with either leads of the button loop. A digital input with high pull-up can read the state of the detector side of the opto-isolator.
This assumes that your extra features do not include providing some kind of visual or auditory output at the button. But remember that just because you want to read the button state, you need not detect it at the button physically--just electrically.


text:
Serial Communication to WPF (Windows Presentation Foundation) giving me odd results. How do I clear up the Strings I am receiving?
I'm trying to make a voltage/temp logger that will post to SQL. I'm using a WPF to make kind of a UI for people to measure the voltage of a cell, and take the temp of the battery acid in the battery. My end goal is to have the Arduino Bluetooth to a computer. the computer will handle all the SQL. The Arduino will have a physical button to post or save the data to my SQL server. Also the Arduino will have a little display to display the battery S/N, Voltage, Temp. (Side Question: Am I going to be able to do the screen and access the serial, with also sending the serial data over Bluetooth?)
My problem is that when I call my function to get that data sometimes it comes out messed up. Sometimes I get, for example: "3.1234 V=" Or "V= 3.123V=" It also happens with the temperature, sometimes I get the voltage in the temp box and vice versa.
More times than not I get a bad result. When I run it in the Serial Monitor with the Arduino IDE It looks fine. Does anyone have any advice how I can clean up the communication and get more reliable results?
Thanks for any help!
I'm using to place the serial port string into a textbox.
txt_Volt.Text = sp.ReadExisting();

I tried using the Serial.flush(); to clear out any old stuff to no avail.
The Arduino code:
else if (c == '3')
 {
   int analog_value = analogRead(A0);
   volt = (analog_value * 5.0) / 1024.0;
   Serial.print("v= ");
   Serial.print(volt, 5);
   Serial.flush();
}

Arduino loop():
void loop() {
  if (Serial.available() > 0)
  { Serial.flush();
    char c = Serial.read();
    if (c == '1')
    {
      digitalWrite(13, HIGH);
      Serial.println("LED is On");
      Serial.flush();
    }

    else if (c == '0')
    {
      digitalWrite(13, LOW);
      Serial.println("LED is off");
      Serial.flush();
    }
    else if (c == '3')
    {
      int analog_value = analogRead(A0);
      volt = (analog_value * 5.0) / 1024.0;
      Serial.print("v= ");
      Serial.print(volt, 5);
      Serial.flush();
    }
    else if (c == '4')
    {
      //Temp Function go HERE
      getTemp();
    }

C# CODE:
         private void Connect_Click(object sender, RoutedEventArgs e)
         {
           while (portNum >= 0) //automaticly connect to correct port.
           {
            try
            {
                String portName = "COM" + portNum;
                comportno.Text = portName;
                //String portName = comportno.Text;
                sp.PortName = portName;
                sp.BaudRate = 9600;
                sp.Open();
                status.Text = "Connected";
            }
            catch (Exception)
            {
                portNum--;
                // MessageBox.Show("Please give a valid port number or check your connection");
                if (portNum == -1)
                {
                    MessageBox.Show("Could not find Arduino\nCheck Connection");
                }
            }
        }

    }

    private void Disconnect_Click(object sender, RoutedEventArgs e)
    {
        try
        {
            sp.Close();
            status.Text = "Disconnected";
        }
        catch (Exception)
        {

            MessageBox.Show("First Connect and then disconnect");
        }
    }

    private void on_Click(object sender, RoutedEventArgs e)
    {
        sp.Write("1");
        rect_LED.Fill = new SolidColorBrush(Color.FromRgb(0, 255, 0));
        // DebugWindow.Text = sp.ReadExisting();
        //  readingStuff();
    }

    private void Of_Click(object sender, RoutedEventArgs e)
    {
        sp.Write("0");
        rect_LED.Fill = new SolidColorBrush(Color.FromRgb(0, 0, 0));
        //  DebugWindow.Text = sp.ReadExisting();
        //  readingStuff();
    }

    private void Get_Volt_On_Click(object sender, RoutedEventArgs e)
    {

        sp.Write("3");
        string volts = sp.ReadExisting();
        int volt_length = volts.Length;

        bool isLetter = !String.IsNullOrEmpty(volts) && Char.IsLetter(volts[0]) && Char.IsDigit(volts[volt_length - 1]);

        if (isLetter)
        {
            DebugWindow.Text = volts;
        }
        else
        {
            DebugWindow.Text = "Error";
            sp.Write("3");
        }
    }

    private void Get_Temp_On_Click(object sender, RoutedEventArgs e)
    {
        sp.Write("4");
        txt_Volt.Text = sp.ReadExisting();
    }

    void readingStuff()
    {
        String comdata = sp.ReadLine();
        Dispatcher.Invoke((Action)(() => DebugWindow.Text += "Data\n" + comdata + "\n"));
    }

What a bad result looks like:

A Good result:

Your problem arises from a mix of newline-terminated and un-terminated messages.
The newline terminated values probably would work by themselves as you can use a ReadLine() type method to wait until they have been completely transferred.
But the non-terminated attempts such as your use of the ReadExisting() method cause a problem - these likely fetch whatever has been received up to the time of the call but that will not necessarily be the full message sent (or even anything at all).   Whatever is left over (had not been received by the time of the call) will become the beginning of the data achieved during the next partial or until-newline read.
As a solution you should probably either:

Terminate each message with a newline

or else

Always read only complete lines, and then parse individual messages out of them

or

Always read until you find some delimiter character such as a space or comma, or a newline.  You may have to write your own read method to accomplish this.

Using delays to try to fix a problem like this is bad practice as it is fragile and can easily break if there is an unexpected delay on the other side, or if the execution speed of one of the components changes.  A number of fragile techniques that generally worked with true serial ports subsequently broke when USB converters were introduced in the middle, as USB bunches data into packets with gaps in between, a behavior not necessarily previously seen in many pure serial implementations.

So if I wanted to read both voltage and temp at the same time, I would have to have the Serial.print(volts) and Serial.println(temp) then have some way of breaking the string apart in my C# code?

That is one way (if you put something in between) the point is that reads not looking for a defined end condition in the data itself are causing your trouble.


text:
Replacement for #include <pins_arduino.h> on particle photon
I've run into this a couple of times when trying to use libraries written for Arduino on a particle photon. Many have the line:
 #include <pins_arduino.h>

which returns the error on the photon compiler:
 fatal error: pins_arduino.h: No such file or directory

I had similar trouble with:
 #include <WProgram.h>

and found an easy fix was to replace that with
 #include "application.h"

I'm wondering if there's a similar easy fix for pins_arduino?

Are you using the web IDE or using Particle Dev?

Also, why would you want to include pins_arduino.h in the first place? It is specifically made for the Arduino, so I don't expect the Photon will accept it.

There are some Arduino libraries, that just implements functionalities that do not depend on hardware. Example of these are almost all those libraries that deal with data structures/types (strings, arrays, trees, lists, etc), or particular algorithms.
If such libraries do not depend on other Arduino-specific libraries, you can use them almost certainly.
Other libraries, instead, heavily depend on the hardware currently used on the Arduino boards. In those cases, the library must access the hardware, therefore they will include verious headers, such as pins_arduino.h (in particular, pin_arduino.h .
These won't work without heavy modification of such libraries and/or the creation of a wrapper header to "emulate" the required functionalities and define the required macros/constants, according to your hardware.


text:
Arduino tool to enumerate where RAM is being used?
In a sketch I have, I use a few libraries and have discovered that a large amount of RAM is being consumed.
Is there a tool that can identify how this RAM is being allocated, e.g. which libraries, which piece of code?

objdump (packaged with the compiler) can show you static allocations but dynamic allocations require running the code with extra instrumentation added to it or in an instrumented simulator, and even then is confined to the branches explored by the run.

How have you discovered this? How much RAM? One trick is to use the F() macro around strings that you are printing. Since you didn't post any code, it is hard to give better advice.

I use this code for Heap memory of AVR (UNO, Mega, etc.):
int freeRam()
{
     extern int __heap_start, *__brkval;
     int v;
     return (int)&v - (__brkval == 0 ? (int)&__heap_start : (int)__brkval);
}

To show heap memory just use Serial.print("Write here a name of the function from which you print it"); Serial.println(freeRam()); anywhere in the code.
Compiler shows stack memory but not the heap, so this code helps me to find exact place where my program uses too much of heap memory. I just print it in every suspicious place in my code.
I hope this will help.


text:
Trouble using lcd.readButtons() in RGBLCDShield library
I am trying to create a state machine that loops in whatever state it's in until a button is pressed.  I am using the Adafruit_RGBLCDShield library along with the LCD shield and 16x2 display.  For some reason the buttons aren't being detected at all.  Here is the code for one of the states:
    case STANDBY_MODE:
  lcd.clear();
  lcd.setBacklight(0x0);
  delay(100);
  noInterrupts();
  digitalWrite(fire, LOW);
  digitalWrite(chg, LOW);
  digitalWrite(trig, LOW);
  analogWrite(eprgm, 0);
  // Wait for button press
  while(1)
  {
    button = lcd.readButtons();
    if(button)
    {
      showLCD();
      t0 = millis();
      state = NO_CHARGE;
      analogWrite(eprgm, (vSet*0.0204)/5);
      interrupts();
      return;
    }
  }
break;

In this state, the system turns off all outputs and display and waits for a button to be pressed.  For some reason, though, it doesn't respond when I press the button.  Is there something missing here?

IMO, your post doesn't provide enough information to allow definitive problem diagnosis.
Why do you say noInterrupts(); at line 5?  Some versions of the Wire library might be interrupt driven[1].  If interrupts were off, such a library wouldn't detect any button presses on a TWI-interfaced shield like Adafruit's RGBLCDShield.
[1]: Per arduino.cc's WireLibraryDetailedReference page,  “"The AVR TWI is byte-oriented and interrupt based...." (section 21.6 on p. 224) ... The TWI module sends an interrupt when it finishes, to notify the processor of the change in conditions ... However, notice that the Wire library has blocking I/O. ” [Ie, the usual Wire library doesn't take advantage of TWI interrupts.]

Thanks, this actually WAS the issue.  I can't use interrupts with the LCD shield interface.


text:
why are there odd spikes in the USB serial data transfer rates?
I'm trying to use an Arduino for data collection, and hoping to get a consistent sampling rate.
I looked into the serial communication using the simplest program I could, but it produces odd results.
void setup() { Serial.begin(9600); }
void loop() { Serial.println("00000"); }

I use a python script to read the data and create a text file and write the time in seconds before the five zeros.
Using the seconds as a marker, I then count the number of data lines for each second.  for example:
44 00000  // recorded at time 44 seconds
44 00000
44 00000
45 00000  // recorded at time 45 seconds, etc

I was expecting that there would be a somewhat stable value for this.  Using 10 bits per character, printing the 5 zeros should be able to be done about 190 times per second.  When analyzed, it turns out to be lower, which isn't surprising due to overhead, but also unexpectedly variable.
Collecting the zeros for 5000 seconds produced the following results:
most often, there were 137 sets of 00000 collected per second, followed by 138 sets of 00000.  This is easily explainable by not being equally spaced per second, and having one second with 137 followed by one second with 138.
What is harder to explain is when it jumps to 139, 140, 141 and 142 sets of 00000 per second.
Out of the 5000 seconds of data, there were 25 seconds where 140 sets of 00000 were created.  That isn't too bad and could be due to timing.
But, out of the 5000 seconds, there were 203 seconds where 142 sets of 00000 were created.
The percent breakdown is as follows:
137 sets of 00000:  79.15%
138 sets of 00000:  13.8%
139 sets of 00000:  0.39%
140 sets of 00000:  0.51%
141 sets of 00000:  2.05%
142 sets of 00000:  4.11%

the first 4 could be explainable with minor timing errors, the last ones are very hard to explain.  with 137 sets of 00000 there are 685 characters sent serially in one second.
with 142 sets of 00000 there are 710 characters sent serially in one second.
What I am trying to figure out is why the variability is so wide and also so consistent - as in the pattern, which can be seen in the graph.

Is there any explanation for the variability?
Because of the variability in the transfer, it is very hard to sync up data or filters or other uses when a constant sample rate is needed.
I've also added delays in the main loop from 1ms to 7ms, 7ms was the maximum because that would not cause the loop to run slower than the free running speed at 142 loops/transmissions per second (1sec/7ms = 142.8 loops per second discounting all other overhead) and found the same patterns.
Using a delay of 8ms produced another interesting result:
with a delay of 8ms, most of the data was transmitted at 123 or 124 sets of 00000 per second, but every 12 seconds there would be a burst of 128 sets of characters.  this makes sense because the delays add up to less than one second for 11 loops, then get an extra loop for that second, but that adds 15 characters, not just 5.
After re-reading this, it dawned on me that there might be some loop timing/buffering errors, so instead of a delay, I used Serial.flush() to pause the loop until the data was sent.
This resulted in a free-running result of 137 sets transmitted per second for the most common, followed by 138 sets.  The new issue is that every 25 seconds there is a drop down to 133 sets of characters transmitted per second, which seems to be the same issue only causing slowing instead of speeding up.
I thought I found the answer with Serial.flush() but there is still something causing huge changes in the sent characters per second.  What could be causing this? and what can be done to make the transfer rates more constant?

While a serial port "kept busy" can potentially produce data with jitter comparable to its clock's jitter reduced by the number of clocks per word, a USB serial converter introduces a bunching of data into packets that is effectively entirely asynchronous.
As a result, once the data has gone through the USB, you really can't determine much of anything about the timing of its origin just by looking at the timing of its arrival.  That remains true even if you are claiming it via a serial-type API on the host, because the USB bus has already irreversibly de-synchronized it in transit.
A more meaningful experiment would be to timestamp the data at the source, ie, on the Arduino.  That could potentially be more regular, but if you use a high enough resolution timestamp, you will still find that it is irregular, as by default the Arduino's foreground thread of execution is periodically interrupted by the timer, which produces a brief delay.
If you are sending serial data into the Arduino or using other hardware peripherals, those may cause additional sporadic delay-inducing interrupts.

This could be largely to do with how USB serial works.
USB has a number of different methods of transferring data between the device and the host. Both CDC/ACM use FT232 use a method called bulk transfer. This is a very low priority transfer method and data is moved across the bus as and when it can - that is, when the bus isn't doing anything else. If there is anything else happening on the bus (and there will be) the transfers get delayed until the bus is doing nothing else.
If timing is critical for a protocol, such as USB audio or video where you have to have the data transferred to the host absolutely right now a different method is used. This is called isochronous. It is the highest priority of data transfer, even higher than interrupt data.
However there is no way on the Arduino to use any form of isochronous transfers so you will have to come up with some other method of managing your timing.
As Chris has mentioned the most common method is to include a timestamp with each packet of data. That packet may contain just one sample, or it may contain a block of samples. The important thing is to know when the block starts and from that infer the time of each sample within the block.
It is also important to ensure that your communication with the host isn't running at 100% saturation. You should be running at the highest baud rate that is reliable and only send data at regular intervals giving you time to get the data in between each transfer. Keeping your data packets as small and efficient as possible is also good for keeping you transfer rate sustained properly.

The problem is not USB priority, it is that USB is asynchronous from the serial source, so packet grouping should be considered meaningless. Time stamping packets is not the solution and not supported without changing the USB converter anyway. The serial data can encode an almost regular timing, but the timing of the data through USB is meaningless and should be ignored by the application in favor of encoded timing, either literal or implied.  Using that, you can do audio over bulk transfers in most modern lightly loaded cases.

I think you misunderstood most of my post there...  CDC/ACM Bulk Transfers are asynchronous to the UART source, yes. Isochronous aren't - they are synchronous (or close enough). That is why they are used for audio and bulk transfers aren't. Yes, it is possible to fudge it enough with bulk transfers using a custom higher level protocol, and it is that higher level custom protocol to which I refer when I talk about timestamping packets - not timestamping USB packets but your serial data. If you have a packet that contains 10 samples which are from 1ms intervals and you know the first sample ...

... is at 829736ms then you also know the time of each subsequent sample in that packet. That batching of packets isn't real-time but it is accurate on a per-sample time basis. Bulk transfers can, and will, be delayed by higher priority USB traffic - especially on a bus that is shared with other devices - especially devices that use isochronous transfers. To get the best results directly connect the Arduino to a USB port on the computer and, if possible, check that other devices don't use the same root hub.

No.  Even isochronous transfers, while more regular in rate, are still asynchronous to the source - and they are allowed to be dropped entirely.  In neither case can one ascribe meaning to the USB timing, or even the timing of the USB packetizing process.  Rather, the timing has to come from the original sample clock, or if one is using a serial UART kept busy to sample something that does not have its own clock, then the baud rate.  The receive then either operates using only the source's timing implicit in the data (ie, if is is only doing signal processing).

Or if it is producing audio output, it must buffer the data and then play back using another sample clock, that is either synchronized by a low bandwidth PLL to the buffer level, or more commonly fixed frequency with a variable sample rate converter in between.

And that is EXACTLY what I am saying in my answer!  ADD YOUR OWN TIMING TO YOUR SENT DATA!

No, you said timestamp the USB packets, which is a fundamental mistake - that captures the meaningless timing of the packetization, not the timing of the source which is what matters.

No that is NOT what I said! Learn English!  "As Chris has mentioned the most common method is to include a timestamp with each packet of data." Not each USB packet. Each packet of DATA!

Which is the USB packets - because there are no "packets" before that.

Yes, there are packets!  At the moment the packets are 6 bytes long - 5 × 0 with a delimiting \n. That is a packet.

Packets exist at different layers in a protocol. Packets within packets within packets.

That could make sense if it were written on its own, but when mentioned following a few mistaken paragraphs implying USB could be source synchronous, it really looks like you are recommending timestamping the USB transfers.

Well I am not. How would you do that anyway? It's not in the CDC/ACM protocol. You are thinking I am recommending something that is not possible to do. Why would you think that?

You had already proposed things not in the CDC/ACM

Especially when I am specifically pointing to what you are saying to do!

Where do I do that then?

Isochronous is not in the CDC/ACM (nor would it solve this problem)

I never said it was. You really do need to learn to read - or at least to pay attention to what you are reading and not skim it.


text:
Possible to condense this if statement?
I have this if statement:
if (now.hour() == 5 && now.minute() == 10 && now.second() == 0 && now.dayOfTheWeek() != 1 && now.dayOfTheWeek() != 7){

Is there a way to condense that for the purposes of saving on some bytes?
Ultimately trying to say "At 5:10 every weekday do X"

If this is using too much space then it's not the condition responsible, it's now.

Well, I was fine (just barely under) until I added the && now.dayOfTheWeek() != 1 && now.dayOfTheWeek() != 7.

In most libraries now.dayOfTheWeek() will actually calculate the day of the week, where at the other functions just load their value straight from the RTC chip. Calculating the day of the week is quite a bit of work. That would explain the jump in code size. The weird thing is that the RTC chip will actually keep track of the day of the week.

The following saves a couple of program bytes (but no RAM) when now is a structure with a byte called DayofWeek:
 if ((byte)(now.DayofWeek+249)>250) ...
   -vs-
 if ((now.DayofWeek != 1 && now.DayofWeek != 7)) ...

It might save slightly more than that in your case, where now.dayOfTheWeek() appears to be a function reference.  This technique will work if function now.dayOfTheWeek() returns a byte, that is, an unsigned char.  The technique depends on value 7+249 overflowing to zero in byte arithmetic when truncated to a byte, because 7+249 is 0 modulo 256.
The cast to byte [or uint8_t] of now.DayofWeek+249 is needed because of int promotion as Edgar Bonet pointed out.

This does not work. You have to cast the sum to uint8_t. Otherwise, per the rules of integral promotion, everything in the expression is evaluated as 16-bit signed ints.

@EdgarBonet, it does work.  Specifically, it gives correct results for now.DayofWeek values from 1 to 7.  Note, now.DayofWeek is declared as a byte (which is equivalent to uint8_t except for being easier to pronounce) so byte, not int, arithmetic is used.

No, it doesn't, and you obviously did not try. If DayofWeek is 7, then DayofWeek+249 is 256, and since 256>250, the test succeeds, while it shouldn't. Note: there is no such thing as “byte arithmetic” in C: the operation is done on ints. C.f. for example this CERT article on integer conversion rules and, more specifically, the section titled “Integer Promotions”.

@EdgarBonet, unfortunately my test printed out the result of assigning now.DayofWeek+249 to a byte – hence the value I expected – rather than the result of the comparison :( , See edit

Yes. The method now() Returns the current time as seconds since Jan 1 1970. Simply keep tract of all your time this way and you only need to test this one value.
The Arduino is not a good source of time over long periods.  Consider using an RTC (Real Time Clock) chip.  This Arduino page links to this page which talks about an RTC.  (I will leave it up to you to research any compatibility issues.)
Many RTCs contain a register set specifically designed to handle tasks such as you outlined above. For example, setting alarms off on weekdays only or on specific days of the month.
If absolute time is not important in your application I would try the following code outline.  Each test only has 2 operands:
// Turn on Arduino on Monday at the time task is to be performed.  Task
// should be performed at that time on Monday, Tuesday, ... Friday.
// Nothing should happen on Saturday & Sunday.  Then cycle repeats.

// Set time to zero.

// Count through days (0, 1, 2, ...).

// Wait each day until number-of-seconds is greater then seconds-in-a-day
// times the day number.

// If day number is 4 or less do activity.  Else skip activity.

// If day number is more than 6 set the day counter to 0 and set the time
// to zero.

If you want to start the Arduino at arbitrary times, set the initial Arduino clock value to the number of seconds from the time the activity would have been performed on Monday and initialize the day counter to the appropriate value.  For example if you started the Arduino on Tuesday 23 hours after the time the activity should have happened on Monday set the Arduino clock to 23 * 60 * 60 seconds and initialize the day counter to 2.  Of course you can calculate the initial day counter value using  = initial_number_of_seconds / 60 * 60 * 24.

I'm trying to get it to be true at a specific time every weekday, so I'm not sure how what you've said applies here.

Answer has been changed.  Consider an RTC.  Most RTCs contain a hardware solution for your situation.  If Arduino time drift is tolerable, use the code outline which only uses seconds in a week to drive events.


text:
Refactor to save bytes?
I'm a painful 128 bytes of my max for this Trinket. Any refactoring I could do to get down the size?
#include <Adafruit_NeoPixel.h>
#include <Wire.h>
#include <RTClib.h>

#define LEDPIN 1
#define TONE 4
#define BTNPIN 3

RTC_DS1307 rtc;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(5, LEDPIN, NEO_RGB);

const long fadeTime = 10 * 60000L; // X minutes
const int colorStops = 255;
const int delaySpeed = fadeTime / colorStops;
const int notes[] = {262,294,330,349};
const uint32_t alarmLength = 5 * 60000L; // 5 minutes

void setup() {
  rtc.begin();
  rtc.adjust(DateTime(__DATE__, __TIME__));

  pinMode(TONE,OUTPUT);
  pinMode(BTNPIN, INPUT);
  digitalWrite(BTNPIN, HIGH);

  strip.begin();
  strip.show();
}

void loop() {
  DateTime now = rtc.now();

  // If it's 5:10 am on a week day, start the fade in
  if (now.hour() == 5 && now.minute() == 10 && now.second() == 0 && now.dayOfTheWeek() != 1 && now.dayOfTheWeek() != 7){
    // Fade in light
    for(int i = 1; i<colorStops; i++){
      if (kill() == true){ break; }

      for(int np = 0;np<strip.numPixels(); np++){
        strip.setPixelColor(np, strip.Color(i,i,i));
      }
      strip.show();
      delay(delaySpeed);
    }

    // Play tone after light fully bright
    for( uint32_t tStart = millis();  (millis()-tStart) < alarmLength; ){
      if (kill() == true){ break; }

      for(int np = 0;np<strip.numPixels(); np++){
         strip.setPixelColor(np, strip.Color(random(50,255),random(50,255),random(50,255)));
      }
      strip.show();

      beep(notes[random(0,3)]);
      delay(100);
    }

    turnOffPixels();
  }
}

void beep(int delayAmount)
{
  for (uint16_t t = 0; t < 30*1000/2; t += delayAmount)
  {
    digitalWrite(TONE,HIGH);
    delayMicroseconds(delayAmount);
    digitalWrite(TONE,LOW);
    delayMicroseconds(delayAmount);
  }
}

void turnOffPixels() {
  for(int np = 0;np<strip.numPixels(); np++){
    strip.setPixelColor(np, strip.Color(0,0,0));
  }
  strip.show();
}

bool kill() {
  if (! digitalRead(BTNPIN)) {
    turnOffPixels();
    return true;
  } else {
    return false;
  }
}

Error...
Sketch uses 5,438 bytes (102%) of program storage space. Maximum is 5,310 bytes.
Global variables use 97 bytes of dynamic memory.

Have you tried using a lighter NeoPixel library?

@IgnacioVazquez-Abrams I wasn't even aware of other NeoPixel libraries...are there any you recommend?

I use light_ws2812 myself. Mostly the C library, but I can see the non-Arduino C++ library being useful in your case.

Remove the rtc.adjust(DateTime(__DATE__, __TIME__));. You only need to set the RTC once, after e.g. you insert the backup battery.
Change
pinMode(BTNPIN, INPUT);
digitalWrite(BTNPIN, HIGH);

to
pinMode(BTNPIN, INPUT_PULLUP);

Inline the beep function using the inline hint:
inline void beep(int delayAmount)
...

Shorter beep function:
inline void beep(int delayAmount)
{
  for (uint16_t t = 0; t < 30*1000; t += delayAmount)
  {
    digitalWrite(TONE,t & 0x01);// HIGH is odd, LOW if even
    delayMicroseconds(delayAmount);
  }
}

To inline a function you use the static keyword, as the compiler essentially ignores inline.

@EdgarBonet The compiled code got smaller with just the inline.

On a quick test build for an ATmega328p type Arduino, the implementation of random() and its unique dependencies seems to be about 180 bytes, so you might see if there's a more compact way of achieving your need there, perhaps using the low byte of some mathematical expression of the time, and just retrying until you get an in-range value.
Of course if you get really stuck, you could remove the bootloader and program it with ISP from an ordinary Arduino or something like that.

I'm inclined to agree with Chris Stratton here. The Trinket has an Attiny85 on it, which has 8k of program memory. However the amount they need for the bootloader limits the memory available to you somewhat. If you program via ICSP you could use all of the 8k of program memory. But if you don't want that inconvenience, finding another Neopixel library, as Ignacio suggested, could help.

Very good suggestions so far. I have only one to add: instead of
strip.Color(0,0,0) use just the constant number 0. This saves a
function call.

For refactoring, consider using a for loop that executes twice, once for the  “// Fade in light” section of code, and once for the  “// Play tone after light fully bright” section.  For parts of the code that differ, test the loop index and do one action or the other.
Here are two ways to get rid of a few (eg 54) bytes of code:

Instead of

 Adafruit_NeoPixel strip = Adafruit_NeoPixel(5, LEDPIN, NEO_RGB);
 ...
 for(int np = 0;np<strip.numPixels(); np++){
 ...

(with three instances of the latter), say something like
enum {numPixels = 5 };
Adafruit_NeoPixel strip = Adafruit_NeoPixel(numPixels, LEDPIN, NEO_RGB);
...
for (byte np=0; np<numPixels; ++np){
...

This will save about 40 bytes (10 bytes per for, and another 10 probably due to strip.numPixels() code not linking).  (Note, the savings is due to getting rid of function calls; the change from int to byte apparently makes no difference in program size, probably because the compiler optimizes int to byte where its analysis shows it can do so.)

Instead of

if (... && now.dayOfTheWeek() != 1 && now.dayOfTheWeek() != 7){

say
if (... && now.dayOfTheWeek()+250>250){

which will save 14 bytes.  This works as explained in my answer to your previous question.  However, I've written +250>250 here instead of the +249>250 there because according to RTClib documentation and RTClib.cpp code, .dayOfTheWeek() returns 0 for Saturday, rather than 1 as you seem to expect.

Possibly inline beep(), since you call it only once.

You mean if (... && (uint8_t)(now.dayOfTheWeek()+250)>250){. C.f. my comment to this answer of yours.