The board that looks like a Pro Mini but with USB is the Micro, or Pro Micro. It uses a slightly different chip, the 32U4 instead of the 328. I think the correct board to choose for it in the IDE is "Arduino/Genuino Micro" but the Leonardo is very similar. The pulser sketch won't compile for this chip without modifications as the 32U4 handles pin change interrupts in a different way: you will get an error message saying that PCMSK2 is not declared in this scope.belli wrote: ↑09 Jun 2018, 23:39 Hi Martin,
I have just connected mine up and have a few questions:
I am not sure if my Arduino Pro Mini is 8MHz or 16MHz, does it make a difference? I'm assuming mine is 16MHZ as it is a 5V unit.
I tried at first with what looks like a Pro Mini but has a USB connection, it identifies as a Leonardo according to the IDE, the sketch won't compile, it this a pin conflict issue? A nano compiled and seemed to run fine.
Is there a way to 'hard code' the frequency? I have an Adams actuator which oscillates very nicely but seems happier at the higher frequency offered by 'full up elevator'. It would be nice to have the option to set the frequency in the software for a 'single channel' only option. I guess the PWM could be hard coded too as per your suggestion above.
Thank you for a great project! I am busy with an airframe, probably a Sniffer as I have just always like the cute stubby nose... I'll probably post the laser files here if anybody else is interested.
Cheers,
The sketch will work on either the 8MHz or 16 MHz versions of any 328 board (Uno, Nano, Pro Mini, ...) If you're not sure which board you have you can find out by means of the Blink sketch. The standard Blink puts the LED on for a second than off for a second so you should see 30 blink cycles each minute. If you've chosen the wrong 16 MHz / 8 MHz choice for your board and upload using a programmer, then the sketch will still run but will give you either 15 or 60 blink cycles in a minute instead of the correct 30.
You don't have to worry too much about the 5V / 3.3V thing when working with Pro Micros unless you have connected peripherals to the Arduino that won't tolerate 5V. The chips on both types of board are exactly the same and both types will work fine at 5V. The only differences between a 5V board and a 3.3V one are the voltage regulator fitted that regulates the incoming 'Raw' or 'V in' voltage down to 5V or 3.3V and the crystal - either an 8 MHz or 16 MHz one. The reason for the speed change is that the makers of the chip say that running it at the higher speed requires the higher voltage for reliable operation - so if you fit a 16 MHz crystal but only work at 3.3V then you are operating outside the specification and the chip will be less reliable. Despite this, I've got some Chinese clone boards with 3.3V regulators but 16 MHz crystals and they actually work fine - I've never had a problem with them. Maybe they would crash when pushing some of the other specified limits of the chip such as operating temperature or electrical load on the pins.
You can 'hard code' the pulsing frequency of the rudder instead of using the elevator input by changing the line in the main pulser.ino file:
Alter the line:
uint16_t cycle = receiver::channel(1); // elevator input on D6: nominally 1000 - 2000 = 0 - 100%
so it's just:
uint16_t cycle = 1000;
That will give very fast pulsing (about 12Hz), 2000 will be quite slow (about 2 Hz). You can experiment by choosing values anywhere in the range 1000 to 2000 to find the one that suits your actuator best.
Similarly you can alter the line:
uint16_t power = receiver::channel(2);
to:
uint16_t power = 1400;
To set the operating power - low numbers below about 1125 will stop the outputs working completely. 1500 means the outputs are powered about 50% of the time and values of about 1800 up to 2000 will make the output be powered almost 100% of the time. Again, experiment and choose a low-ish number that gives reliable operation - the lower the number you choose the less power drain from your battery (although the power drain with the motor I used is never very high).