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.
Locked
User avatar
jc27
 
Posts: 185
Joined: Sun Nov 24, 2013 5:05 am

Re: Servo rotation and 315Mhz T/R help

Post by jc27 »

Using the buck converter and an A23 12v battery, I got about 2 hours of run time. I had the battery power the trinket and the 315mhz receiver.
I have an idea of using one of the 5v rechargeable power packs, but the one I have shuts off because the trinket and receiver do not pull enough power to keep the pack turned on. I'm going to figure out the resistance I need for an led and see if that helps keep the pack on.
Right now it looks like 4 AA batteries is the best option, but I'm wondering what the life of those batteries would be if I use them to power the entire circuit including the servo.

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

Re: Servo rotation and 315Mhz T/R help

Post by adafruit_support_bill »

If you are using the alkaline version of the A23, you will be losing some capacity to internal resistance. 9v cells suffer from this problem also at anything more than trickle currents. i believe there are lithium versions of the A23. But i don't have any experience with them. You might also look into something like 2x CR123 pack - although the holders for those are not easy to find.

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 did some tests, and the li-po pack I bought didn't work. The circuit doesn't draw enough current to keep the pack turned on. I bought a different pack to see if I can get that one to work, and if it doesn't then that idea is scrapped.
I was thinking of maybe powering the entire circuit (including the servo) with 4 AA lithiums. To see how long they would last I was thinking of writing a different sketch that would alternately raise and lower the servo arm. Would I need to include the refresh section of this sketch in the new one? The new sketch isn't going to use any switches, I'm basically looking for a version of the "sweep" example but have it rotate 90 degrees rather than the 180 that is in the "sweep" example.

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

Re: Servo rotation and 315Mhz T/R help

Post by adafruit_support_bill »

If you are using soft-servo, you need the refresh.

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

Re: Servo rotation and 315Mhz T/R help

Post by jc27 »

Ok, I will try to come up with something this weekend.

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

Re: Servo rotation and 315Mhz T/R help

Post by jc27 »

Here is what I came up with regarding the new sketch. I would like this new sketch to do a complete servo rotation (down, then up) once every minute. I want the sketch to do it automatically without any input from a button, this way I can see how long the batteries will last. I'm still trying to figure out the best way to power everything in the smallest and cheapest way, so as of now, a rechargeable 6v battery pack from an RC car seems to be the best bet. I bought a couple of different 5v portable battery packs, but since the circuit doesn't draw a lot of power, the packs shut off. I tried adding an LED or two, but that didn't help. With the extra LEDs, the power pack stays on, but the voltage drop is too much to power the servo correctly; it moves down but not back up. I am hoping either the 6v RC car battery pack or some high capacity lithium AAs will power the entire circuit for more than 4 hours, I would like 8 hours, but I don't know if that is being too optimistic.
The whole circuit (trinket, receiver and servo when it is not moving ) draws around 40mA, but when the servo moves it jumps to around 500mA. But since the rotation only last for a second ot two, its not too bad.
Anyway, here is the new sketch. please let me know if I am on the right track.

Code: Select all

// this sketch is intended to have the servo make one complete rotation (down then back up) every minute  
#include <Adafruit_SoftServo.h>
Adafruit_SoftServo servo1;
int pos = 0;
void setup()
{
  OCR0A = 0xAF; 
  TIMSK |= _BV(OCIE0A);
  servo1.attach(1);
  servo1.write(0);
}
void loop()
{
  for (int i = 0; i < 144; i++)
  {
    pos ++;
    servo1.write(pos);
    delay(6);
  }
  for (int i = 144; i > 0; i--)
  {
    pos --;
    servo1.write(pos);
    delay(15);
  }
  delay(30000); // I would like the delay to be one minute before the next rotation, but I did some reading and I am not too     sure what the value here should be
}
volatile uint8_t counter = 0;
SIGNAL(TIMER0_COMPA_vect)
{
  counter +=2;
  if (counter >=20)
  {
    counter =0;
    servo1.refresh();
  }
}
    
  

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

Re: Servo rotation and 315Mhz T/R help

Post by jc27 »

Another question. Could the traco dc buck converter handle a 12v 1300 to 1600mah battery pack? It's looking like a rechargeable battery pack is the way I am leaning, and the 12v packs are easy to come by. I'm just wondering if the traco converter can handle the current capacity of the pack. It should, since the while circuit draws around 600ma max, and that is only for a second or two when the servo rotates.

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

Re: Servo rotation and 315Mhz T/R help

Post by adafruit_support_bill »

For the Traco, you only need to worry about the demands of the load. 600mA is well within its capabilities.

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

Re: Servo rotation and 315Mhz T/R help

Post by jc27 »

The code works good, all I need now is to try it with 4 rechargeable AA batteries. Will the trinket run off of the 4.8 from them or will I need to step up to at least 6v? I'm thinking that I should get some half way decent run time if I use a 6v rechargeable pack with 1300 to 1600mAh. I know I could get more if I use anything from 7.2 to 12v, but then I will have to use the buck converter and I am trying to keep the keep the price down. I will use a high voltage pack if I have to, but i am hoping a 6v pack will get me around 4-6 hours at least.

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 see that there is a trinket pro that is about the same as an arduino uno. Will the cad files be posted to github for free and if so can I send them to the PC board builder to have them import it into their cad software?

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

Re: Servo rotation and 315Mhz T/R help

Post by jc27 »

The code works just like I was hoping for so thank you for your help. Now that the trinket pro is available. I'm going to try another sketch that will use the rotation part of this code and add some flashing LEDs.
When I start that project I will strt another thread for it.
One of my last questions for this thread is about the receiver and transmitter. Since it's a simple 315mhz combo, any other 315mhz transmitter will cause it to rotate. Is there a way to match each pair so other signals will not cause the sketch to run or will I need an entirely new wireless setup?

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

Re: Servo rotation and 315Mhz T/R help

Post by adafruit_support_bill »

The chips used in these do have a configurable key-code. As shipped they all have the default code. Unfortunately, we do not have any documentation on exactly how to key these. But if you look at the receiver, you will see that half of the pins are un-soldered. According to the data sheet, these are the address pins. It is a reasonable bet that these simply need to be tied to either VCC or GND to address the receiver. The transmitter data sheet indicates that it is similarly addressable. But I haven't cracked one open to take a look.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Servo rotation and 315Mhz T/R help

Post by adafruit_support_mike »

I've poked around inside the transmitter, and IIRC there's a section in the radio chip's datasheet about the addressing protocol.

Each pin can be in three possible states: HIGH, LOW, or unconnected. The chip knows how to identify each state, so there are something like 3^8 possible addresses. Use the same connections for both the sender and the receiver.

There's a row of eight solder jumper patterns on the back of the receiver, right behind the pin header, each having pads for the pin, VCC, and GND. There's a similar pattern on the PCB inside the keyfob.

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 will check out the data sheet to see if I can locate the jumper pins and how they work.
I will be ordering a batch of the R/T kits. Is it possible to get the receivers with the header pins not soldered on? The receiver sits flat on my PC board so I have to desolder the 90 degree headers and install straight ones.
Also any info on the cad file of the trinket pro? I sent the PC board company the standard trinket CAD files and they created the footprint for it in their software. If the files for the trinket pro are also free, I would like to do the same thing.

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

Re: Servo rotation and 315Mhz T/R help

Post by adafruit_support_bill »

The receivers come to us with the header pins already soldered.
I'll check on the Trinket Pro files. It is a new product and it usually takes a little while to get the files cleaned up for publication.

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

Return to “Arduino”