Servo rotation and 315Mhz T/R help

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
jc27
 
Posts: 185
Joined: Sun Nov 24, 2013 5:05 am

Re: Servo rotation and 315Mhz T/R help

Post by jc27 »

Sorry its been so long for a reply, been busy with the little amount of spare time that I have. I am going to try the code out using the Uno tonight and have everything run off of a regulated 5v 1-10A power supply. That amount of current will power everything, so I should know if the receiver/transmitter combo will work the way I want it to.
If everything works the way I hope it will, I should be ready to alter the code to be able to load it onto the trinket. To do this all I have to do is change the servo library to the one you mentioned earlier as well as load the trinket library into the Arduino IDE correct, or is there some other changes to the code I will need to do?
Another question about the receiver, the header pins on it are set up for the receiver to sit vertical, if I were to change the header pins so that it sits horizontal, would it affect its performance? I am planning on having the trinket and receiver mounted onto a newly designed pc board that will be located inside of a small box, so should I have the receiver antenna wire sticking out of the box? (the box will be made of plastic, so I don't have to worry about accidentally making a Faraday container that will block the RF signals).
Lastly, is it possible to use an single ATtiny chip for the rotation code? While the trinket is very small, I was wondering if it was possible to make the circuit even smaller. I have a USB ATtiny programmer (I got it from sparkfun, sorry) and a few ATtiny 85s that I was going to use for fading in and out an LED. I can't seem to find a smaller RF transmitter/receiver combo that is smaller than the 315MHz system you sell so I am planning on staying with it, but if I can use a single ATtiny85 (along with some other circuit components like resistors and such), it would make the circuit very small and the space constrains would most likely not come into play.

User avatar
jc27
 
Posts: 185
Joined: Sun Nov 24, 2013 5:05 am

Re: Servo rotation and 315Mhz T/R help

Post by jc27 »

Well I got it running, but with a couple of hiccups.
Here is how I had the power routed: USB powered the Uno, a separate 5v supply for the servo and the receiver was powered by the 5v out on the Uno.
Here is how it was wired when it worked correctly:
The positive of the PS to the servo red wire and the negative PS side to the black wire. The receiver +5 volts to the 5v out on the Uno and the ground on the receiver to a ground pin on the Uno. Output 1 on receiver to a 10k resistor then to pin 4 on the Uno, output 2 to a10k then to Uno pin 5. Pin 9 on Uno to yellow wire on servo.
Now here is the funny part. To get the servo to rotate when a button on the fob was pushed (and not have it just rotate by itself and become unstable), the negative side of the power supply had to get connected to ground along with the ground on the receiver and the servo which were tied to a ground pin on the Uno.
When I tried to power the receiver with the 5v power supply, the servo would only rotate in one direction, and I had to touch the other pin with the Uno 5v out to get the servo to rotate back to the stating position.
Is it possible to power the receiver with 5v out on the trinket? Would 4 high capacity rechargeable AA batteries provide enough voltage to power everything or should I use a 9v?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Servo rotation and 315Mhz T/R help

Post by adafruit_support_bill »

the negative side of the power supply had to get connected to ground along with the ground on the receiver and the servo which were tied to a ground pin on the Uno.
Yes. When working with multiple power sources, you have to tie all the grounds together so that the signals have a common voltage reference.
Is it possible to power the receiver with 5v out on the trinket? Would 4 high capacity rechargeable AA batteries provide enough voltage to power everything or should I use a 9v?
You should be able to power it from the trinket 5v out. 4xAA is a much better choice than a standard 9v cell.

User avatar
jc27
 
Posts: 185
Joined: Sun Nov 24, 2013 5:05 am

Re: Servo rotation and 315Mhz T/R help

Post by jc27 »

Since the code seems to work, I'm going to try to get he trinket library loaded and try to get the code altered so it can be uploaded.
I may have to use a different servo because the one I have now is a bit jerky when it rotates down, but not as much when it goes back up. If I need a bigger servo, I will have to increase the number of batteries.

User avatar
jc27
 
Posts: 185
Joined: Sun Nov 24, 2013 5:05 am

Re: Servo rotation and 315Mhz T/R help

Post by jc27 »

Is it possible to use a chip from an arduino instead of an attiny or trinket? That way I wouldn't have to change the code and could design the entire board myself, except for the receiver.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Servo rotation and 315Mhz T/R help

Post by adafruit_support_bill »

Yes. Atmega328 chips are available. You can plug them into an Arduino for programming if you want, then move them to your own circuit board. http://www.adafruit.com/products/123

User avatar
jc27
 
Posts: 185
Joined: Sun Nov 24, 2013 5:05 am

Re: Servo rotation and 315Mhz T/R help

Post by jc27 »

That may be what I decide to do. I don't have to add any libraries to the IDE correct? Just pop the one in my uno out, put the new one in, upload the sketch, then put the new chip on my newly designed board. Is that right?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Servo rotation and 315Mhz T/R help

Post by adafruit_support_rick »

Depending on where you get the chip, you may have to program the Arduino bootloader.
If you get it from us, the bootloader is pre-programmed with the "DUEMILANOVE with ATMEGA328" bootloader. You just have to pick that in the IDE (instead of picking the Uno).

User avatar
jc27
 
Posts: 185
Joined: Sun Nov 24, 2013 5:05 am

Re: Servo rotation and 315Mhz T/R help

Post by jc27 »

I think I will go that route. That way I don't have to change the code, can put the chip on my custom board rather than build the board around the trinket. Now if I could just build a receiver into the board then I would be golden lol.

User avatar
jc27
 
Posts: 185
Joined: Sun Nov 24, 2013 5:05 am

Re: Servo rotation and 315Mhz T/R help

Post by jc27 »

Now will I need any components on the pins on the atmega chip like caps or resistors? What about the receiver board, is there a way to filter some of the noise but not to the point where it will not work? I am a little concerned that the receiver transmitter combo will not be robust enough due to the rf noise that it may pick up.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Servo rotation and 315Mhz T/R help

Post by adafruit_support_bill »

For the Atmega, the DC Boarduino schematic is a good reference to work from: http://learn.adafruit.com/boarduino-kits/downloads

For the receiver, you can experiment with it near an operating Arduino to get an idea of what interference you might run into. Keeping the antenna end of the board away from the processor is probably a good start.

User avatar
jc27
 
Posts: 185
Joined: Sun Nov 24, 2013 5:05 am

Re: Servo rotation and 315Mhz T/R help

Post by jc27 »

Again, sorry for the long delay, real life tends to get in the way. I am leaning towards using one of your chips with the booltloader preloaded, since I can just pop in in my Uno and load the sketch. Where can I get the schematic with the pin outs and a spec sheet with the voltage limits for it? What other components will I need to connect with it (resistors, caps, ect.), or do I need to only worry about the input power and the I/O pins? If I am using a single power source for the chip, receiver, and servo should I be worried about the current draw for the other components as well as voltage and current spikes?
Worse case scenario, I just use the trinket since all I need to do is just change the library for the servo and it should work, but I would really like to use the Arduino chip since I wont have to really change the code and it would be a smaller footprint on the PC board than the trinket.
I am ordering 2 of the bootloaed chips as well as the usb boardurino now, so once I get them the questions will be flowing again.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Servo rotation and 315Mhz T/R help

Post by adafruit_support_bill »

Here is the circuit for a minimal Arduino: http://arduino.cc/en/Tutorial/ArduinoToBreadboard
You just need a 16MHz crystal, a couple of caps and a resistor.
The full processor datasheet is here: http://www.atmel.com/images/atmel-8271- ... asheet.pdf

User avatar
jc27
 
Posts: 185
Joined: Sun Nov 24, 2013 5:05 am

Re: Servo rotation and 315Mhz T/R help

Post by jc27 »

So looking at the first link you posted, I would need all that stuff to run the code from the atmel chip? I was under the impression that could pop a boot loaded atmel into my uno, load the sketch, then pop it out and it would be ready to run. If I need the crystal and the other parts, I may as well use an arduino mini or micro to run the sketch.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Servo rotation and 315Mhz T/R help

Post by adafruit_support_bill »

You can run one without the crystal. http://www.instructables.com/id/The-RRR ... h-You-in-/
But not at 16mHz. The internal chip clock is 8MHz. That will change the timing and require some hacking of the servo library.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”