Loading...
  Show Posts
Pages: [1] 2 3 ... 9
1  Using Arduino / Programming Questions / Sending a number instead of a Byte using RF communication. on: May 10, 2013, 11:09:13 am
Whats up Arduino forum? Recently I have managed to create a data transmitter out of an Attiny85 and a RF Link Transmiter - 4800bps (434MHz) from SparkFun. The receiver is an Arduino Uno and a RF Link Receiver - 4800bps (434MHz) connected to a computer for Serial Monitoring.  smiley-money
https://www.sparkfun.com/products/10532
https://www.sparkfun.com/products/10534

Since there are very few libraries that support Attiny85, I had to create my own transmitter and receiver code. They are extremely minimalistic, but they work pretty well! Basically the transmitter code consists of a function called byteSend() . What it does is chop up a letter that is typed into it, into bits and send the bits through the transmitter one at a time. For now, I can only send one byte at a time, so in order to create a sentence I have to create many byteSend() functions.The Receiver does the opposite of the transmitter, it collects the the bits and packs them into a byte in order to send them over the Serial Monitor. smiley-sweat

Despite the fact that transmitting letters works with my code, I eventually want to transmit temperature readings from the analog pin on the Attiny85. For this I have to convert the analog reading which is an Int, into a byte, so I can send it via the Transmitter. I tried to send one digit ints through the link but I believe they consist of two bytes so that's probably the reason why It didn't work. Here is how I did it. smiley-neutral

Code:
int d = 7;
byteSend(d);

Is there a way to convert the int into a byte that the function will be able to send? smiley-roll
Thanks guys. smiley-surprise
 
Here is the transmitter code:
Code:

 
 // Data pin that connects to the transimter's DATA IN pin
 int dataPin = 2;
 void setup(){
   // Set up the Data pin as an Output
   pinMode(dataPin, OUTPUT);
 }

 void loop(){
   // Send some bytes continuesly
   byteSend('T');
   byteSend('E');
   byteSend('S');
   byteSend('T');
   byteSend('#');
   delay(10);
 }

 // Function that will simplify the process of sending a letter
 void byteSend (byte inputByte){
    int i;
   
    // Loop that will make the reciever wake up and adjust its amplification
    for(i=0; i<20; i++){
      digitalWrite(dataPin, HIGH);
      delayMicroseconds(50);
      digitalWrite(dataPin, LOW);
      delayMicroseconds(50);
    }
   
   // A 3ms delay in order to synch the transimtter and get ready for data transmition
   digitalWrite(dataPin, HIGH);
   delayMicroseconds(3000);
   digitalWrite(dataPin, LOW);
   delayMicroseconds(500);
   
   // A loop that goes throught all the bits in a byte and transimts accordingly
   for(i=0; i<8; i++){
     
   if (bitRead(inputByte,i)==1) {
     digitalWrite(dataPin, HIGH);
     delayMicroseconds(1000);
   }
   
   if (bitRead(inputByte,i)==0) {
     digitalWrite(dataPin, LOW);
     delayMicroseconds(1000);
 }
2  Using Arduino / LEDs and Multiplexing / Re: Help with transistor and resistor selection for LED array on: May 09, 2013, 09:00:04 am
Use this link, will be very helpful next time. smiley
http://ledcalculator.net/
3  Using Arduino / Microcontrollers / Re: Decreasing the baud rate of Serial communication. on: March 21, 2013, 06:30:39 pm
Do you have to use the serial library???? I've personally used the Manchester library together with RF Link transmitter/receiver.. Without any issues.. I had the transmitter connected to the Attiny85 and the receiver to a atmega328p.. Here is the library if you want to try it out:
https://github.com/mchr3k/arduino-libs-manchester/

Never heard of it before! Thanks, I will check it out!

4  Using Arduino / Microcontrollers / Decreasing the baud rate of Serial communication. on: March 21, 2013, 06:05:12 pm
Hi Arduino Forum. Recently I've got my Attiny85 talking to the Computer through an Arduino UNO. I followed the tutorial here:
http://www.instructables.com/id/Attiny-serial-monitor-using-arduino-walkthrough/?ALLSTEPS

Everything worked perfect. I just had to connect one of the pins on the Attiny85 to the TX pin on the Arduino board. However I need to extend the capabilities of Serial communication between the Arduino and Attiny85. I want to go wireless with these RX linkers from SparkFun:

https://www.sparkfun.com/products/10534 - RF Link Transmitter (434MHz) from SparkFun for about 4$
https://www.sparkfun.com/products/10532 - RF Link Receiver (434MHz) from SparkFun for about 5$

I have them already, but they require a baud rate of less than 4800bps. I don't know why, but when I change the number in the Serial.begin() function from 9600 to some less number, it gives me an error. It says that its possible only to have a 9600, 32300 or 110000bps baud rate.

Is it possible to fix this problem, or can you suggest a way on how to get the communication working.
5  Using Arduino / Installation & Troubleshooting / Re: Installing driver for UNO on: March 20, 2013, 03:37:34 pm
Thanks to Apple for creating such simple machines that allow to avoid these kinds of problems smiley
6  Using Arduino / Networking, Protocols, and Devices / Re: Two arduino communication (serial) on: March 20, 2013, 02:05:03 pm
You should consider the Wire library as well.
http://arduino.cc/en/Reference/Wire
7  Using Arduino / Project Guidance / Re: RF transmitter and reciver on: March 20, 2013, 02:03:05 pm
Or these:
https://www.sparkfun.com/products/10532
https://www.sparkfun.com/products/10534
8  Using Arduino / Interfacing w/ Software on the Computer / Re: Serial port prints on one line! How to solve? on: March 20, 2013, 10:56:55 am
alternative is the use of \n

Serial.print("first line\n second line\n");

Besides \n the \t (tab is also interesting as it allows to columnize numbers and text in the output (copy to Excel is a breeze;).

Thanks robtillaart! In fact I was doing a temperature logging project a while ago and I couldn't understand what "/n" means in other people's code examples. I worked with Excel as well in my project so your comment is very useful to me.
I didn't know nothing about "\t" at all, I always was searching for something similar to it.
Appreciate your help!
9  Using Arduino / Microcontrollers / Re: Why an Attiny85 running at 8MHz is under clocked when programming with Arduino. on: March 19, 2013, 10:07:16 pm
Tips here for minimal boards: http://www.gammon.com.au/forum/?id=11637

Those chips ship by default with the "divide by 8" fuse set.

Wow! Thanks for the link. I love your site by the way, Its very helpful smiley
10  Using Arduino / Programming Questions / Re: Serial.Begin statements on: March 19, 2013, 03:41:51 pm
Not in hardware.  

There is still SoftwareSerial available.  Depending on the device, this may be sufficient.

Didn't know that it is possible through software, but here is what the Library also says:

Quote
Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69
Not all pins on the Leonardo support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).

It talks about the Mega and the Leonardo but not about Arduino UNO for example. So is it actually not compatible with all models?
11  Using Arduino / General Electronics / Re: How to control very very really very high currents with arduino? on: March 19, 2013, 02:22:44 pm
Using a relay:
https://www.sparkfun.com/products/100
12  Using Arduino / General Electronics / Re: how to reduce the electrical noise on: March 19, 2013, 02:22:02 pm
I think a pull–up resistor between a pin and VCC would help.


Which pin and VCC ? sorry im very new to arduino land.

For example: If you are using a wire (you would actually be using at least two in this case) to communicate with another Arduino. And you would want to reduce the noise, consider connecting a part of the wire to the vcc through a pull-up resistor. Connect the end of the wire to the final destination.
13  Using Arduino / General Electronics / Re: how to reduce the electrical noise on: March 19, 2013, 02:03:05 pm
I think a pull–up resistor between a pin and VCC would help.
14  Using Arduino / Interfacing w/ Software on the Computer / Re: Serial port prints on one line! How to solve? on: March 19, 2013, 01:55:40 pm
Well perhaps you could try using:

Serial.println(reading); instead of Serial.print(reading);

Lefty

Thanks for the post, exactly what I needed! smiley
15  Using Arduino / Programming Questions / Re: Map button matrix to integers on: March 19, 2013, 01:51:11 pm
That does not make sense either. You cannot read 2 pins at the sametime with just one digital read. I don't know, maybe we finally can, and I just didn't get the memo.

Maybee, we both didn't get the memo smiley-grin But what I meant in my code is reading the value of a button that is on a specific X Y coordinate. A 2D array must be used for this to work.
Pages: [1] 2 3 ... 9