|
|
|
|
|
|
|
Arduino and HobbyKing Multi-Rotor Control Board V3.0 or KKmulticontroller v5.5
My first post. Hello everyone.
![]() This should be interesting to those who are into Arduino and have either the HobbyKing Multi-Rotor Control Board V3.0 or KKmulticontroller v5.5. Once set up (and with a usbasp programmer) you can use the Arduino IDE to code and upload directly to the controller board. Great for those who want to roll their own controller software. Instructions, example and pin mapping below: More detailed instructions here : http://www.rchacker.com/diy/arduino-...v3-0-atmega328 Code:
/*
Configuring arduino dev environment for the HobbyKing Multi-Rotor Control Board V3.0 (Atmega328 PA)
or KKmulticontroller v.5.5 “Blackboard”
using arduino 1.01
and a usbasp programmer, www.fischl.de from hobbyking
if you are running windows you will have to install the drivers for the usbasp programmer.
In osx, show package contents on arduino.app. Windows I'm not sure program files or such.
add the new board to Contents/Resources/Java/hardware/arduino/boards.txt
##############################################################
hobbyking_v3.name=Hobbyking v3.0 ATmega328
hobbyking_v3.upload.protocol=arduino
hobbyking_v3.upload.maximum_size=30720
hobbyking_v3.upload.speed=57600
#hobbyking_v3.bootloader.low_fuses=0xFF
#hobbyking_v3.bootloader.high_fuses=0xDA
#hobbyking_v3.bootloader.extended_fuses=0x05
#hobbyking_v3.bootloader.path=atmega
#hobbyking_v3.bootloader.file=ATmegaBOOT_168_atmega328_pro_8MHz.hex
#hobbyking_v3.bootloader.unlock_bits=0x3F
#hobbyking_v3.bootloader.lock_bits=0x0F
hobbyking_v3.build.mcu=atmega328p
hobbyking_v3.build.f_cpu=8000000L
hobbyking_v3.build.core=arduino
hobbyking_v3.build.variant=hobbyking_v3
##############################################################
nagivate to Contents/Resources/Java/hardware/arduino/cores/arduino/variants/standard/pins_arduino.h
make a new variant based on the above. hobbyking_v3/pins_arduino.h
add the following.
const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
// .....
// added the below lines
PB,
PB,
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
// .....
// added the below lines
_BV(6),
_BV(7),
now we have digital pins 20 and 21
To program select your programmer and then use upload using programmer in the file menu.
Marc Griffith, 2012
*/
//spare analog pads on back should just work.
const unsigned int PAD_A6 = A6;
const unsigned int PAD_A7 = A7;
//spare digital pads on back.
const unsigned int PAD_RX = 0; //PD0
const unsigned int PAD_D4 = 4; //PD4 (PCINT20/XCK/T0)
//we could also use digital 11,12,13 (MOSI,MISO,SCK) as long as no low impedence loads
const unsigned int PIN_MOSI_D11 = 11; //PB3
const unsigned int PIN_MISO_D12 = 12; //PB4
const unsigned int PIN_SCK_D13 = 13; //PB5
//and the rest...
const unsigned int PIN_LED = 20; //PB6
const unsigned int PIN_AIL = 1; //PD1 (TXD)
const unsigned int PIN_ELE = 2; //PD2
const unsigned int PIN_THR = 3; //PD3
const unsigned int PIN_RUD = 21; //PB7
const unsigned int PIN_M6 = 5; //PD5
const unsigned int PIN_M5 = 6; //PD6
const unsigned int PIN_M4 = 7; //PD7
const unsigned int PIN_M3 = 8; //PB0
const unsigned int PIN_M2 = 9; //PB1
const unsigned int PIN_M1 = 10; //PB2
const unsigned int GYR_ROL = A2; //PC2
const unsigned int GYR_PIT = A1; //PC1
const unsigned int GYR_YAW = A0; //PC0
const unsigned int POT_YAW = A5; //PC5
const unsigned int POT_PIT = A4; //PC4
const unsigned int POT_ROL = A3; //PC3
//some example code:
#include <Servo.h>
Servo servoOne;
Servo servoTwo;
Servo servoThree;
int temp = 0;
void setup() {
servoOne.attach(PIN_M1);
servoTwo.attach(PIN_M2);
pinMode(PIN_LED,OUTPUT);
digitalWrite(PIN_LED,HIGH); //I am alive
delay(10);
digitalWrite(PIN_LED,LOW);
}
void loop() {
temp = analogRead(GYR_ROL);
temp = map(temp,0,1023,0,179);
servoOne.write(temp);
temp = analogRead(POT_YAW);
temp = map(temp,0,1023,0,179);
servoTwo.write(temp);
}
|
|
|
|
|
|
|
|
Thanks!
This is JUST what I was looking for!
|
|
Latest blog entry: SkullCopter Labs
|
|
|
|
|
|
|
What have you done so far? You have to edit two text files, It does not get any simpler.
I have expanded on the instructions here, http://www.rchacker.com/diy/arduino-on-the-hobbyking-multi-rotor-control-board-v3-0-atmega328 Let me know if you still have problems. |
|
|
|
|
Joined Apr 2012
348 Posts
|
But just a very dumb and out of the blue question..Is it possible to write a multirotor firmware using the arduino libraries and syntax..for the hk kk board...keeping in mind the strict EEPROM memory constraints..if it can be written it will at-least provide a ray of hope for newbie coders wanting to develop their own firmware ...I know the multiwii and APM firmwares have been written keeping the arduino hardware in mind..but what about the kk board...I dont know but I am just asking roughly what is coming to my mind......
|
|
|
|
|
||
|
Ukraine, L'vivs'ka, L'viv
Joined Aug 2012
28 Posts
|
Quote:
|
|
|
||
|
|
|
|
Joined Apr 2012
348 Posts
|
thats right but the ocsillator frequency is also a deciding factor for the speed of calculations..all the arduino boards as stated earlier have a 16Mhz external oscillator which is more stable than the 8 Mhz internal Osc on the HK kk 3.0 board..even though the processor is the same will this work for half the operating frequency
|
|
|
|
|
||
|
Ukraine, L'vivs'ka, L'viv
Joined Aug 2012
28 Posts
|
Quote:
I think it will be able to fly even with Arduino. However that software will never be a best performer (maybe there will be not enough CPU speed to handle accelerometer/Bluetooth/GPS/etc.) but it is not needed if you just want to learn programming. And you can always rewrite your SW without Arduino libraries if you want to make it run faster. |
|
|
||
|
|
||
|
|
Quote:
As long as you avoid floats and divides your Arduino code should perform plenty fast enough. Use hardware PWM, not software PWM for the esc's and use interrupts to capture your rc data. Ardupilot has good libraries for this, there is even a PID library with examples. |
|
|
||
|
|
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Discussion !!NEW!! HobbyKing Multi-Rotor Control Board V3.0 | ishaan65 | Multirotor Talk | 8 | Jul 25, 2012 04:36 AM |
| Question Quad Build Using HobbyKing Multi-Rotor Control Board V3.0 (Atmega328 PA) | SJackson | Multirotor Talk | 27 | Apr 30, 2012 08:51 PM |
| Discussion Help with HobbyKing Multi-Rotor Control Board V2.1 (Atmega168PA) | rpscarlets2294 | Multirotor Talk | 2 | Apr 21, 2012 09:17 PM |
| Discussion Direction of flight on quadrocopter with KKMulticontroller V5.5 Controller Board | Darn Servo ! | Multirotor Talk | 4 | Apr 17, 2012 09:31 PM |