Posts | Comments

Planet Arduino

Archive for the ‘generator’ Category

If you live somewhere prone to power outages, you might have thought about buying a generator. The problem is that small generators are cheap but — well — small. Big generators are expensive. [Jake von Slatt] had an idea. He has a “yard car” which we thought might be a junk car but, instead, it is an old car he uses to drive around his yard doing tasks. It has a winch and a welder. Now it has a big generator, too. You can follow the project in the three videos found below.

The project started with a scrap generator with a blown motor. Of course, the car has a motor so — in theory — pretty simple. Remove the generator from the motor and graft it to the car’s motor. But the details are what will kill you.

The first video shows the teardown of the generator unit and some planning. Some custom parts that were recovered from the scrap pile replaced some of the parts on the generator, including a custom casting leftover from another project that took a bit of machining to repurpose.

By the second video, he had a proof of concept working, but it had a small problem. He was controlling the speed of the motor with a stick on the accelerator linkage. So, he modified an idler from an AC compressor to limit the speed of the generator. The final video uses an Arduino to drive the cruise control to keep a steady RPM to the generator.

Overall, this is an interesting project both because it is unusual and useful, but also because of the wide range of skills [Jake] demonstrates — he knows his way around a machine shop, a car, and the Arduino. Pretty impressive!

We’d rather reuse a car engine than drive the generator ourselves. For some reason, that comes up repeatedly.

Following the time-honored YouTube tradition of ordering cheap stuff online and playing with it while the camera runs, [Monta Elkins] bought a Stirling engine that drives a DC motor used as a generator. How much electrical juice can this thing provide, running on just denatured alcohol? (Will it blend?)

The answer is probably not really a spoiler: it generates enough to run “Blink.ino” on a stock Arduino, at least when powered directly through the 5 V rail. [Monta] recorded an open-circuit voltage of around 5 V, and a short-circuit current of around 100 mA at a measured few hundred millivolts. While he didn’t log enough of the points in-between to make a real power curve, we’re guessing the generator might be a better match for 3.3 V electronics. The real question is whether or not it can handle the peaky demands of an ESP8266. Serious questions, indeed!

The video is a tad long, but it’s more than made up for by the sight of an open flame vibro-botting itself across his desk while [Monta] is trying to cool the cold side down with a melting ice cube. Which got us thinking, naturally. If you just had two of the Stirling engines


Filed under: Arduino Hacks, misc hacks





Kingduino Uno R3 Compatible Microcontroller - Atmel ATmega328

Turnigy TGY-SM-3317SR 360? Analog Robot Servo 2.2kg / 86RPM / 19g

Took the electronics from two of these and connected them to the servo motors to control the mirrors
Turnigy TGY-SM-3317SR 360? Analog Robot Servo 2.2kg / 86RPM / 19g


Kingduino Compatible 5V 650nm PCB Laser Diode Module

Microphone Sound Input Module

Russian blue cat
I found this cat really helped with the programming 






Very simple sketch

I tinkered for a while to get the patterns I liked and the transitions 

#include

Servo myservo1; // create servo object to control a servo
Servo myservo2;

int patterns[] =
{
92,88,
70,85,
60,85,
80,85,
85,85,
70,85,
85,0,
85,110,
85,115,
70,88,
5,30,
135,45,
92,88,
180,0,
50,100,
85,85,
100,105,
70,0,
75,0,
105,115
};

int NumPatterns = 0;



int laserPin = 3; // LED connected to digital pin 9
int ledPin = 4; // LED connected to digital pin 9
int MicPin = 1; // potentiometer connected to analog pin 3
int LevelPin = 0;
int pos = 0; // variable to store the servo position

int val = 0; // variable to store the read value
int val2 = 0;
int tick = 500;
int TickMod = 500;
int Sweep = 0;
int LaserPWM = 0;
int LaserPWMvector = 1;

int Mirror1 = 0;
int Mirror2 = 0;

int Mic = 0;
int Level = 0;

int LevelIndex = 0;
int LevelBuf[200] = {0, };
int LevelMean = 0;

int LevelValueIndex = 0;
int LevelValueBuf[10] = {0, };

int ShutOffBits = 50;
int Active = 0;



void setup()
{
Serial.begin(9600);

pinMode(laserPin, OUTPUT); // sets the pin as output
pinMode(ledPin, OUTPUT); // sets the pin as output
myservo1.attach(8); // attaches the servo on pin 9 to the servo object
myservo2.attach(9); // attaches the servo on pin 9 to the servo object

pos = 30;
myservo1.write(pos);

pos = 95;
myservo2.write(pos);

digitalWrite(laserPin, HIGH);

randomSeed(analogRead(0));

NumPatterns = sizeof(patterns);

}

void loop()
{
tick++;

Mic = analogRead(MicPin);

LevelMean = CalcLevelMean();

Level = CalcLevelValue();

if(LevelMean > ShutOffBits)
Active = 1;
else
Active = 0;

if((tick % 10) == 0)
{
//LaserPWM += LaserPWMvector;
val = abs(Level - LevelMean);
if(val < 1) val = 1;
if(val > 5) val = 5;

if(LaserPWMvector > 0)
LaserPWM += val;
else
LaserPWM -= val;

if(LaserPWM < 0) { LaserPWM = 0; LaserPWMvector = 1; StepPattern("PWM == 0n");}
if(LaserPWM > 255){ LaserPWM = 255; LaserPWMvector = 0-1; }
}

val = LaserPWM;

if(Active > 0)
analogWrite(laserPin, val); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
else
digitalWrite(laserPin, LOW);

//val = map(abs(Level - 512), 0, 512, 0, 255);

//analogWrite(ledPin, val);


if((tick % 100) == 0)
SendData("");

//if(abs(Level - 512) > 100)
// StepPattern("LOUD");

delayMicroseconds(1000);

if((tick % 100) == 0)
SetMirrors("");


}


void StepPattern(char* txt)
{

Sweep += 2;
if(Sweep > (NumPatterns - 2)) Sweep = 0;

}

void SetMirrors(char* txt)
{

if(Active > 0)
{
val = random(0,100);

//Serial.print("nRANDOM: ");
//Serial.print(val);
//Serial.print("n");

if(val > 500)
{
val = abs(Level - LevelMean) + (Mic - 512);

val = map(val, 0, 512, 0, 20);

Serial.print("MUSIC:");
Serial.print(val);

pos=90+val;
myservo1.write(pos);

pos=90-val;
myservo2.write(pos);


}
else
{
//Serial.print("nSWEEPn");

val2 = abs(Level - LevelMean);


pos = Mirror1;

val = (patterns[Sweep] - Mirror1) /10;

if(val < 1) val = 1;

pos += val;

pos = patterns[Sweep] + val2;

myservo1.write(pos);

Mirror1 = pos;



pos = Mirror2;

val = (patterns[Sweep + 1] - Mirror2) /10;

if(val < 1) val = 1;

pos += val;

pos = patterns[Sweep + 1] - val2;

myservo2.write(pos);

Mirror2 = pos;

}

}
else
{
pos = 90;
myservo1.write(pos);
myservo2.write(pos);
}

//SendData(txt);
}

void SendData(char* txt)
{
if(strlen(txt) > 0)
{
Serial.print("n");
Serial.print(txt);
Serial.print("n");
}

Serial.print("Sweep:");
Serial.print( Sweep);

Serial.print("tLevel - LevelMean: ");
Serial.print(abs(Level - LevelMean));

Serial.print("tMirror1 & Mirror2: ");
Serial.print( Mirror1);
Serial.print(" ");
Serial.print( Mirror2);


Serial.print("tLaserPWMvector:");
Serial.print( LaserPWMvector);
Serial.print("tLaserPWM:");
Serial.print( LaserPWM);
Serial.print("tLevelMean:");
Serial.print( LevelMean);
Serial.print("tLevel:");
Serial.print(analogRead(LevelPin));
Serial.print("tmic:");
Serial.print(analogRead(MicPin));
Serial.print("n");

}

int CalcLevelMean()
{

LevelBuf[LevelIndex] = analogRead(LevelPin);

if((++LevelIndex) > 199)
LevelIndex = 0;

double ltot = 0.0;
for(int i = 0;i < 200;i++)
ltot += (double)LevelBuf[i];

return (int)(ltot / 200.0);
}

int CalcLevelValue()
{

LevelValueBuf[LevelValueIndex] = analogRead(LevelPin);

if((++LevelValueIndex) > 10)
LevelValueIndex = 0;

double ltot = 0.0;
for(int i = 0;i < 100;i++)
ltot += (double)LevelValueBuf[i];

return (int)(ltot / 100.0);
}


Introduction

There has been a lot of talk lately about inexpensive DDS (direct digital synthesis) function generators, and I always enjoy a kit – so it was time to check out the subject of this review. It’s the “FG085 miniDDS function generator” from JYE Tech. JYE is a small company in China that makes inexpensive test equipment kits, for example their capacitance meter (my first kit review!) and DSO. The capacitance meter was good, the DSO not so good – so let’s hope this is better than their last efforts.

Assembly

The instructions (AssemblyGuide_085G) are much better than previous efforts, and if you have bought the kit – read them. The kit arrives in a large zip-lock bag, with the following bundle of parts:

The AC adaptor is 100~240V in, 15V DC out. Everything is included with the kit including a short BNC to alligator clips lead for output. The PCBs are very good, with a nice solder mask and silk screen:

and back:

At this point we realise that most of the work is already done. There’s two microcontrollers ATmega48 and ATmega168- one for display and user-interface control, and the other for function generation. It takes only a few minutes to solder in the through-hole parts, headers and sockets:

… then you flip over the PCB and add the LCD:

… followed by the buttons and rotary encoder. From previous research this is the part that causes people a lot of trouble – so read carefully. There’s a lot of buttons – and if they aren’t inserted into the PCB correctly your life will become very difficult. The buttons must be inserted a certain way – they’re “polarised” – for example:

As you can see above, one side has a double-vertical line and the other side has a single. When you fit the buttons to the PCB – the side with the double-vertical must face the left-hand side of the PCB – the side with the DC socket. For example:

Furthermore, don’t be in a rush and put all the buttons in then try to solder them all at once.  Do them one at a time, and hold them tight to the PCB with some blu-tac or similar. If they don’t sit flush with the PCB the front panel won’t fit properly and the buttons will stick when in use. So exercise some patience, and you’ll be rewarded with an easy to use function generator. Rush them in and you’ll be very unhappy. I warned you! After fitting each button, test fit the front panel to check the alignment, for example:

Then you end up with nicely-aligned buttons:

… which all operate smoothly when the panel is fitted:

After the buttons comes the rotary encoder. Be very careful when fitting it to the PCB – the data legs are really weak, and bend without much effort. If you push in the encoder, be mindful of the legs not going through the holes and bending upwards. Furthermore, when soldering in the encoder note that you’re really close to an electrolytic – you don’t want to stab it with a hot iron:

The CP2012 chip in the image above is for the USB interface. More on that later. Now the next stage is the power-test. Connect DC power and turn it on – you should be greeted by a short copyright message followed by the operation display:

If you didn’t – remove the power and check your soldering –  including the capacitor polarities and look for bridges, especially around the USB socket. Now it’s time to fit the output BNC socket. For some reason only known to the designers, they have this poking out the front of the panel for the kit – however previous revisions have used a simple side-entry socket. Thus you need to do some modifications to the supplied socket. First, chop the tag from the sprocket washer:

… then remove the paper from the front panel:

Now solder a link to the washer in a vertical position:

… then fit the BNC socket to the panel, with the washer aligned as such:

Finally, align the top panel with the PCB so the BNC socket pin and washer link drop into the PCB and solder them in:

If you want to use the servo mode, solder three short wires that can attach to a servo form the three “output” pads between the BNC and USB socket.

Finally, screw in the panels and you’re finished!

Using the function generator

Operation is quite simple, and your first reference should be the manual (manual.pdf). The display defaults to normal function generator mode at power-up – where you can adjust the frequency, offset, amplitude and type of output – sine, square, triangle, ramp up, ramp down, staircase up and down:

The ranges for all functions is 0~10 khz, except for sine which can hit 200 kHz. You can enter higher frequencies, such as up to 250 kHz for sine – but the results aren’t so good.

Instead of filling this review with lots of screen dumps from an oscilloscope to demonstrate the output – I’ve made the following video where you can see various functions being displayed on a DSO:

You can also create signals to test servos, with adjustable pulse-width, amplitude and cycle times. However you’ll need to solder three wires onto the PCB (next to the BNC socket area) to attach to the servo.

According to the user manual and various retailers’ websites – the FG085 can generate frequency sweeping signals. These are signals that sweep from a start to as finish frequency over a period of time. However the firmware on the supplied unit is old and needs updating to enable this function. You can download the firmware in .hex file format from here. Then go and dig up an AVR programmer and avrdudeAt the time of writing we had some issues with the signature not being recognised when updating the firmware, and solidly bricked the FG085. Our fault – so when that’s sorted out we’ll update the review – stay tuned.

There is also a USB port on the side – after installing CP2102 drivers in Windows we could connect at 115200 bps with terminal, however all the FG085 returned was the firmware version number. Perhaps later on the designers will update the firmware to allow for PC control. Somehow I wouldn’t bank on it.

Oh – if you’re wondering what DDS is - click here!

Conclusion

It’s an interesting piece of equipment. Putting the firmware upgrade issues to one side, the FG085 does what it sets out to do. During testing it worked well, and we didn’t come across any obvious inaccuracies during use.  The price varies between US$43 and $50 – so for that money it’s  a good kit. Just take care during construction and you’ll be fine.

The function generator is available in kit form or assembled, with or without panels from China. The kit version with panels is also available from Sparkfun (KIT-11394) and their resellers. Full-sized images available on flickr. This kit was purchased and reviewed without notifying the supplier.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.


Introduction

There has been a lot of talk lately about inexpensive DDS (direct digital synthesis) function generators, and I always enjoy a kit – so it was time to check out the subject of this review. It’s the “FG085 miniDDS function generator” from JYE Tech. JYE is a small company in China that makes inexpensive test equipment kits, for example their capacitance meter (my first kit review!) and DSO. The capacitance meter was good, the DSO not so good – so let’s hope this is better than their last efforts.

Assembly

The instructions (AssemblyGuide_085G) are much better than previous efforts, and if you have bought the kit – read them. The kit arrives in a large zip-lock bag, with the following bundle of parts:

The AC adaptor is 100~240V in, 15V DC out. Everything is included with the kit including a short BNC to alligator clips lead for output. The PCBs are very good, with a nice solder mask and silk screen:

and back:

At this point we realise that most of the work is already done. There’s two microcontrollers ATmega48 and ATmega168- one for display and user-interface control, and the other for function generation. It takes only a few minutes to solder in the through-hole parts, headers and sockets:

… then you flip over the PCB and add the LCD:

… followed by the buttons and rotary encoder. From previous research this is the part that causes people a lot of trouble – so read carefully. There’s a lot of buttons – and if they aren’t inserted into the PCB correctly your life will become very difficult. The buttons must be inserted a certain way – they’re “polarised” – for example:

As you can see above, one side has a double-vertical line and the other side has a single. When you fit the buttons to the PCB – the side with the double-vertical must face the left-hand side of the PCB – the side with the DC socket. For example:

Furthermore, don’t be in a rush and put all the buttons in then try to solder them all at once.  Do them one at a time, and hold them tight to the PCB with some blu-tac or similar. If they don’t sit flush with the PCB the front panel won’t fit properly and the buttons will stick when in use. So exercise some patience, and you’ll be rewarded with an easy to use function generator. Rush them in and you’ll be very unhappy. I warned you! After fitting each button, test fit the front panel to check the alignment, for example:

Then you end up with nicely-aligned buttons:

… which all operate smoothly when the panel is fitted:

After the buttons comes the rotary encoder. Be very careful when fitting it to the PCB – the data legs are really weak, and bend without much effort. If you push in the encoder, be mindful of the legs not going through the holes and bending upwards. Furthermore, when soldering in the encoder note that you’re really close to an electrolytic – you don’t want to stab it with a hot iron:

The CP2012 chip in the image above is for the USB interface. More on that later. Now the next stage is the power-test. Connect DC power and turn it on – you should be greeted by a short copyright message followed by the operation display:

If you didn’t – remove the power and check your soldering –  including the capacitor polarities and look for bridges, especially around the USB socket. Now it’s time to fit the output BNC socket. For some reason only known to the designers, they have this poking out the front of the panel for the kit – however previous revisions have used a simple side-entry socket. Thus you need to do some modifications to the supplied socket. First, chop the tag from the sprocket washer:

… then remove the paper from the front panel:

Now solder a link to the washer in a vertical position:

… then fit the BNC socket to the panel, with the washer aligned as such:

Finally, align the top panel with the PCB so the BNC socket pin and washer link drop into the PCB and solder them in:

If you want to use the servo mode, solder three short wires that can attach to a servo form the three “output” pads between the BNC and USB socket.

Finally, screw in the panels and you’re finished!

Using the function generator

Operation is quite simple, and your first reference should be the manual (manual.pdf). The display defaults to normal function generator mode at power-up – where you can adjust the frequency, offset, amplitude and type of output – sine, square, triangle, ramp up, ramp down, staircase up and down:

The ranges for all functions is 0~10 khz, except for sine which can hit 200 kHz. You can enter higher frequencies, such as up to 250 kHz for sine – but the results aren’t so good.

Instead of filling this review with lots of screen dumps from an oscilloscope to demonstrate the output – I’ve made the following video where you can see various functions being displayed on a DSO:

You can also create signals to test servos, with adjustable pulse-width, amplitude and cycle times. However you’ll need to solder three wires onto the PCB (next to the BNC socket area) to attach to the servo.

According to the user manual and various retailers’ websites – the FG085 can generate frequency sweeping signals. These are signals that sweep from a start to as finish frequency over a period of time. However the firmware on the supplied unit is old and needs updating to enable this function. You can download the firmware in .hex file format from here. Then go and dig up an AVR programmer and avrdudeAt the time of writing we had some issues with the signature not being recognised when updating the firmware, and solidly bricked the FG085. Our fault – so when that’s sorted out we’ll update the review – stay tuned.

There is also a USB port on the side – after installing CP2102 drivers in Windows we could connect at 115200 bps with terminal, however all the FG085 returned was the firmware version number. Perhaps later on the designers will update the firmware to allow for PC control. Somehow I wouldn’t bank on it.

Oh – if you’re wondering what DDS is - click here!

Conclusion

It’s an interesting piece of equipment. Putting the firmware upgrade issues to one side, the FG085 does what it sets out to do. During testing it worked well, and we didn’t come across any obvious inaccuracies during use.  The price varies between US$43 and $50 – so for that money it’s  a good kit. Just take care during construction and you’ll be fine.

The function generator is available in kit form or assembled, with or without panels from China. The kit version with panels is also available from Sparkfun (KIT-11394) and their resellers. Full-sized images available on flickr. This kit was purchased and reviewed without notifying the supplier.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column? And join our friendly Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

The post Kit Review – JYE Tech FG085 DDS Function Generator appeared first on tronixstuff.



  • Newsletter

    Sign up for the PlanetArduino Newsletter, which delivers the most popular articles via e-mail to your inbox every week. Just fill in the information below and submit.

  • Like Us on Facebook