From 0b6f47f099d763bec4b937b9f504b1f7c8471d17 Mon Sep 17 00:00:00 2001 From: Abel Tim Date: Thu, 20 Jun 2024 21:07:25 +0200 Subject: poster --- CODE/CODE.ino | 4 + IMU_comp/IMU_comp.ino | 32 + lower_connection_schema.pdf | Bin 129143 -> 140538 bytes motordriver/motordriver.ino | 10 +- motordriver/nomultiplexer/nomultiplexer.ino | 192 ++ pcb_boven/pcb_boven.pro | 12 +- pcb_boven/pcb_boven.sch | 10 +- pcb_boven/pcb_boven.sch-bak | 52 +- pcb_onder/pcb_onder.pro | 14 +- pcb_onder/pcb_onder.sch | 10 +- pcb_onder/pcb_onder.sch-bak | 27 +- poster.svg | 3041 +++++++++++++++++++++++++++ upper_connection_schema.pdf | Bin 168395 -> 182354 bytes 13 files changed, 3349 insertions(+), 55 deletions(-) create mode 100644 IMU_comp/IMU_comp.ino create mode 100644 motordriver/nomultiplexer/nomultiplexer.ino create mode 100644 poster.svg diff --git a/CODE/CODE.ino b/CODE/CODE.ino index 0db480a..5f04f5c 100644 --- a/CODE/CODE.ino +++ b/CODE/CODE.ino @@ -98,6 +98,10 @@ MAKE_TYPE_INFO( short ) void setup() { Serial.begin(9600); Serial1.begin(19200); + + //connect unconected pins to GND + pinMode(40, INPUT_PULLUP); + pinMode(41, INPUT_PULLUP); // Initialize first MCP23017 with I2C address 0x20 if (!mcp1.begin_I2C(mcp1ADDR)) { diff --git a/IMU_comp/IMU_comp.ino b/IMU_comp/IMU_comp.ino new file mode 100644 index 0000000..40d99b6 --- /dev/null +++ b/IMU_comp/IMU_comp.ino @@ -0,0 +1,32 @@ +//https://www.pololu.com/product/2862 +#include +#include + +LIS3MDL mag; + +char report[80]; + +void setup() +{ + Serial.begin(9600); + Wire.begin(); + + if (!mag.init()) + { + Serial.println("Failed to detect and initialize magnetometer!"); + while (1); + } + + mag.enableDefault(); +} + +void loop() +{ + mag.read(); + + snprintf(report, sizeof(report), "M: %6d %6d %6d", + mag.m.x, mag.m.y, mag.m.z); + Serial.println(report); + + delay(100); +} diff --git a/lower_connection_schema.pdf b/lower_connection_schema.pdf index 704a16c..5092bf1 100644 Binary files a/lower_connection_schema.pdf and b/lower_connection_schema.pdf differ diff --git a/motordriver/motordriver.ino b/motordriver/motordriver.ino index 35d6885..0fd30e7 100644 --- a/motordriver/motordriver.ino +++ b/motordriver/motordriver.ino @@ -1,4 +1,8 @@ //moveohmi = https://robotics.stackexchange.com/questions/7829/how-to-program-a-three-wheel-omni + + +#include + // motor one int enA = 33; int in1 = 2; @@ -195,8 +199,7 @@ void turn(int speed){ digitalWrite(in6, LOW); } -void moveohmi(int speed, int direction) -{ +void moveohmi(int speed, int direction){ turnoff(); double dirrad = (direction*71) / 4068; dirA = 1.047198-dirrad; @@ -209,8 +212,7 @@ void moveohmi(int speed, int direction) Bmove(spdB); Cmove(spdC); } -void beddermoveohmi(int speed, int direction) -{ +void beddermoveohmi(int speed, int direction){ turnoff(); double dirrad = (direction*71) / 4068; diff --git a/motordriver/nomultiplexer/nomultiplexer.ino b/motordriver/nomultiplexer/nomultiplexer.ino new file mode 100644 index 0000000..d2800a8 --- /dev/null +++ b/motordriver/nomultiplexer/nomultiplexer.ino @@ -0,0 +1,192 @@ +//moveohmi = https://robotics.stackexchange.com/questions/7829/how-to-program-a-three-wheel-omni +//https://www.pololu.com/product/2997 +//https://www.pololu.com/product/4861 +// +// motor one +int m1penA = 1; +int m1enB = 2; +int m1pwm1 = 3; +int m1pwm2 = 4; +int m1encA = 13; +int m1encB = 14; +// motor two +int m2enA = 5; +int m2enB = 6; +int m2pwm1 = 7; +int m2pwm2 = 8; +// motor three +int m3enA = 9; +int m3enB = 10; +int m3pwm1 = 11; +int m3pwm2 = 12; + +int sp = 160; + +double dirA = 0.00; +double dirB = 0.00; +double dirC = 0.00; +double spdA = 0.00; +double spdB = 0.00; +double spdC = 0.00; +double dirrad = 0.00; + +void setup() +{ + // set all the motor control pins to outputs + pinMode(m1enA, OUTPUT); + pinMode(m1enB, OUTPUT); + pinMode(m2enA, OUTPUT); + pinMode(m2enB, OUTPUT); + pinMode(m3enA, OUTPUT); + pinMode(m3enB, OUTPUT); + + pinMode(m1pwm1, OUTPUT); + pinMode(m1pwm2, OUTPUT); + pinMode(m2pwm1, OUTPUT); + pinMode(m2pwm2, OUTPUT); + pinMode(m3pwm1, OUTPUT); + pinMode(m3pwm2, OUTPUT); + + pinMode(m1encA, INPUT); + pinMode(m1encB, INPUT); +} + +void Amove(int sped){ + digitalWrite(m1enA, HIGH); + digitalWrite(m1enA, LOW); + sp = abs(sped); + if (sped < 0) { + Serial.print("back"); + analogWrite(m1pwm1, sp); + digitalWrite(m1pwm2, LOW); + } else { + Serial.print("forward"); + digitalWrite(m1pwm1, LOW); + analogWrite(m1pwm2, sp); + } + Serial.println(sp); +} +void Bmove(int sped) { + Serial.print("moving B "); + if (sped < 0) { + digitalWrite(in3, LOW); + digitalWrite(in4, HIGH); + Serial.print("back"); + } else { + digitalWrite(in3, HIGH); + digitalWrite(in4, LOW); + Serial.print("forward"); + } + Serial.print("with speed: "); + int sp = abs(sped); + analogWrite(enB, sp); + Serial.println(sp); +} +void Cmove(int sped) { + Serial.print("moving C "); + if (sped < 0) { + digitalWrite(in5, LOW); + digitalWrite(in6, HIGH); + Serial.print("back"); + } else { + digitalWrite(in5, HIGH); + digitalWrite(in6, LOW); + Serial.print("forward"); + } + Serial.print("with speed: "); + int sp = abs(sped); + analogWrite(enC, sp); + Serial.println(sp); +} + +void turnoff(){ + Serial.println("stop"); + analogWrite(enA, 0); + analogWrite(enB, 0); + analogWrite(enC, 0); + digitalWrite(in1, LOW); + digitalWrite(in2, LOW); + digitalWrite(in3, LOW); + digitalWrite(in4, LOW); + digitalWrite(in5, LOW); + digitalWrite(in6, LOW); +} +void forward(int speed){ + Serial.println("forward"); + analogWrite(enA, speed); + analogWrite(enB, speed); + analogWrite(enC, speed); + digitalWrite(in1, LOW); + digitalWrite(in2, LOW); + digitalWrite(in3, HIGH); + digitalWrite(in4, LOW); + digitalWrite(in5, HIGH); + digitalWrite(in6, LOW); +} +void turn(int speed){ + Serial.println("turn"); + analogWrite(enA, speed); + analogWrite(enB, speed); + analogWrite(enC, speed); + digitalWrite(in1, HIGH); + digitalWrite(in2, LOW); + digitalWrite(in3, HIGH); + digitalWrite(in4, LOW); + digitalWrite(in5, HIGH); + digitalWrite(in6, LOW); +} + +void moveohmi(int speed, int direction){ + turnoff(); + double dirrad = (direction*71) / 4068; + dirA = 1.047198-dirrad; + dirB = 3.141593-dirrad; + dirC = 5.235988-dirrad; + spdA = speed*sin(dirA); + spdB = speed*sin(dirB); + spdC = speed*sin(dirC); + Amove(spdA); + Bmove(spdB); + Cmove(spdC); +} +void beddermoveohmi(int speed, int direction){ + turnoff(); + + double dirrad = (direction*71) / 4068; + Serial.println(dirrad); + //vector ontb in x en y + double x = sin(dirrad)*speed; + double y = cos(dirrad)*speed; + Serial.println((String)"x:"+x+" y:"+y); + spdA = -0.5*x - sqrt(3)/2*y; + spdB = x; + spdC = -0.5*x + sqrt(3)/2*y; + Amove(spdA); + Bmove(spdB); + Cmove(spdC); + + Serial.println(spdA); + Serial.println(spdB); + Serial.println(spdC); + Serial.println(); + Serial.println(); +} +void loop() +{ + delay(1000); + turnoff(); + beddermoveohmi(255, 0); + delay(1000); + turnoff(); + Amove(255); + delay(1000); + turnoff(); + Bmove(255); + delay(1000); + turnoff(); + Cmove(255); + delay(1000); + turnoff(); + turn(254); + delay(1000); +} diff --git a/pcb_boven/pcb_boven.pro b/pcb_boven/pcb_boven.pro index 152769c..0b90d6d 100644 --- a/pcb_boven/pcb_boven.pro +++ b/pcb_boven/pcb_boven.pro @@ -1,4 +1,4 @@ -update=22/05/2015 07:44:53 +update=Thu Jun 20 20:04:17 2024 version=1 last_client=kicad [general] @@ -31,3 +31,13 @@ NetIExt=net version=1 LibDir= [eeschema/libraries] +[schematic_editor] +version=1 +PageLayoutDescrFile= +PlotDirectoryName= +SubpartIdSeparator=0 +SubpartFirstId=65 +NetFmtName= +SpiceAjustPassiveValues=0 +LabSize=50 +ERC_TestSimilarLabels=1 diff --git a/pcb_boven/pcb_boven.sch b/pcb_boven/pcb_boven.sch index b27d1c1..771cb94 100644 --- a/pcb_boven/pcb_boven.sch +++ b/pcb_boven/pcb_boven.sch @@ -4,13 +4,13 @@ EELAYER END $Descr A3 16535 11693 encoding utf-8 Sheet 1 1 -Title "" +Title "Upper_pcb" Date "" Rev "" -Comp "" -Comment1 "" -Comment2 "" -Comment3 "" +Comp "Mendelcollege" +Comment1 "For more info email 10810@mendelcollege.nl" +Comment2 "https://github.com/ableTI/robotica/" +Comment3 "https://mendelcollege.nl/ontdek-je-talenten/robotica-en-beta/" Comment4 "" $EndDescr $Comp diff --git a/pcb_boven/pcb_boven.sch-bak b/pcb_boven/pcb_boven.sch-bak index 960a626..b27d1c1 100644 --- a/pcb_boven/pcb_boven.sch-bak +++ b/pcb_boven/pcb_boven.sch-bak @@ -790,40 +790,8 @@ Wire Wire Line 8200 5825 8700 5825 Connection ~ 8200 2375 Connection ~ 8700 5825 -Wire Wire Line - 8750 5425 4975 5425 -Wire Wire Line - 4975 5425 4975 7700 -Wire Wire Line - 4975 7700 5025 7700 Wire Wire Line 5025 8100 4800 8100 -Wire Wire Line - 5025 7800 4950 7800 -Wire Wire Line - 4950 7800 4950 5300 -Wire Wire Line - 4950 5300 8275 5300 -Wire Wire Line - 8275 5300 8275 5125 -Wire Wire Line - 8275 5125 8750 5125 -Wire Wire Line - 8750 5225 8325 5225 -Wire Wire Line - 8325 5225 8325 5350 -Wire Wire Line - 8325 5350 4925 5350 -Wire Wire Line - 4925 5350 4925 7900 -Wire Wire Line - 4925 7900 5025 7900 -Wire Wire Line - 7225 8600 8475 8600 -Wire Wire Line - 8475 8600 8475 5325 -Wire Wire Line - 8475 5325 8750 5325 Wire Wire Line 7350 7300 8100 7300 Wire Wire Line @@ -1201,4 +1169,24 @@ F 3 "~" H 3575 7100 50 0001 C CNN $EndComp Wire Wire Line 4500 6025 7275 6025 +Wire Wire Line + 4925 6700 4925 5350 +Wire Wire Line + 4925 5350 8550 5350 +Wire Wire Line + 8550 5350 8550 5525 +Wire Wire Line + 8550 5525 8750 5525 +Wire Wire Line + 4925 6700 5025 6700 +Wire Wire Line + 8750 5625 8525 5625 +Wire Wire Line + 8525 5625 8525 5375 +Wire Wire Line + 8525 5375 4950 5375 +Wire Wire Line + 4950 5375 4950 6800 +Wire Wire Line + 4950 6800 5025 6800 $EndSCHEMATC diff --git a/pcb_onder/pcb_onder.pro b/pcb_onder/pcb_onder.pro index 152769c..8c5dc78 100644 --- a/pcb_onder/pcb_onder.pro +++ b/pcb_onder/pcb_onder.pro @@ -1,6 +1,6 @@ -update=22/05/2015 07:44:53 +update=Thu Jun 20 20:07:36 2024 version=1 -last_client=kicad +last_client=eeschema [general] version=1 RootSch= @@ -31,3 +31,13 @@ NetIExt=net version=1 LibDir= [eeschema/libraries] +[schematic_editor] +version=1 +PageLayoutDescrFile= +PlotDirectoryName= +SubpartIdSeparator=0 +SubpartFirstId=65 +NetFmtName= +SpiceAjustPassiveValues=0 +LabSize=50 +ERC_TestSimilarLabels=1 diff --git a/pcb_onder/pcb_onder.sch b/pcb_onder/pcb_onder.sch index db82ace..c7f9381 100644 --- a/pcb_onder/pcb_onder.sch +++ b/pcb_onder/pcb_onder.sch @@ -4,13 +4,13 @@ EELAYER END $Descr A3 16535 11693 encoding utf-8 Sheet 1 1 -Title "" +Title "Lower pcb" Date "" Rev "" -Comp "" -Comment1 "" -Comment2 "" -Comment3 "" +Comp "Mendelcollege" +Comment1 "For more info: 10810@mendelcollege.nl" +Comment2 "https://mendelcollege.nl/ontdek-je-talenten/robotica-en-beta/" +Comment3 "https://github.com/ableTI/robotica/" Comment4 "" $EndDescr $Comp diff --git a/pcb_onder/pcb_onder.sch-bak b/pcb_onder/pcb_onder.sch-bak index bae3a48..db82ace 100644 --- a/pcb_onder/pcb_onder.sch-bak +++ b/pcb_onder/pcb_onder.sch-bak @@ -85,7 +85,7 @@ Wire Wire Line Wire Wire Line 5750 4050 5750 4150 Wire Wire Line - 1400 4125 1400 5950 + 1400 4125 1400 4650 Wire Wire Line 975 4050 975 6850 Wire Wire Line @@ -604,10 +604,10 @@ Connection ~ 6525 7200 Wire Wire Line 6525 7200 6325 7200 $Comp -L Device:R i2c_res +L Device:R i2c_res1 U 1 1 666C9452 P 6400 7475 -F 0 "i2c_res" H 6470 7521 50 0000 L CNN +F 0 "i2c_res1" H 6470 7521 50 0000 L CNN F 1 "R" H 6470 7430 50 0000 L CNN F 2 "custom:resistor" V 6330 7475 50 0001 C CNN F 3 "~" H 6400 7475 50 0001 C CNN @@ -656,8 +656,6 @@ Connection ~ 4075 4050 Wire Wire Line 4075 4050 5750 4050 Connection ~ 3975 4125 -Wire Wire Line - 3975 4125 5650 4125 $Comp L tb9051ftg:TB9051FTG motor_driver3 U 1 1 66365747 @@ -683,7 +681,7 @@ $EndComp Wire Wire Line 1400 4125 2325 4125 Wire Wire Line - 3975 4125 2325 4125 + 3975 4125 3225 4125 Connection ~ 2325 4125 Wire Wire Line 2325 4125 2325 4150 @@ -742,4 +740,21 @@ Wire Wire Line 8100 5850 8100 4800 Wire Wire Line 8100 4800 7950 4800 +Wire Wire Line + 1575 4650 1400 4650 +Connection ~ 1400 4650 +Wire Wire Line + 1400 4650 1400 5950 +Wire Wire Line + 3225 4650 3225 4125 +Connection ~ 3225 4125 +Wire Wire Line + 3225 4125 2325 4125 +Wire Wire Line + 4900 4650 4900 4125 +Wire Wire Line + 3975 4125 4900 4125 +Connection ~ 4900 4125 +Wire Wire Line + 4900 4125 5650 4125 $EndSCHEMATC diff --git a/poster.svg b/poster.svg new file mode 100644 index 0000000..2303fb4 --- /dev/null +++ b/poster.svg @@ -0,0 +1,3041 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + https://github.com/ableTI/robotica/ + https://mendelcollege.nl/ontdek-je-talenten/robotica-en-beta/ + sites: + + + + + Software engineer: Abel Tim + 10810@mendelcollege.nl + 10498@mendelcollege.nl + + people: + + Hardware engineer: Jorn Schouten + General : Nathanaƫl den Hertog + + 10832@mendelcollege.nl + + contact info: + Software + + + + + + + + + + software + There are two codes for this robot becouse there are two microcontrollers on the robot. +-The camera's code is written in python. The code is written so that you can select the goal collor using input from a dip switch. After you select the goal collor it will detect it and output where the goal is reletive to the robot in degrees. This is send to the teensy using a uart connection. +-The teensy's code is written in loops of a few microseconds. At the start of each loop it will garther all incoming data first. This is the sensor data from IR seekers, compas data and color sensor data. It also collects the data from the camera about where the goal is located. After it has collected the data it will first check the color sensors if it is on a line and needs to move back. After that it will check if it has the ball using one of the IR seekers. If it has then it will go towards the goal using the camera data. If it does not have the ball it will go towards the ball using the other IR seekers. + IR seekers + We use the TSSP 4038 IR recievers to locate the ball. + Camera + We use openmv H7 to find the goal. + Motors + We are using the pololy metal gearmotors to move the robot. + upper pcb + We designd the upper pcb to hold most of the microchips and the IR seeksers. + lower pcb + + This pcb holds the color sensors and motor drivers. it also connecs to the motors. + color sensors + We are using the TCS34725 color sensors to detect the lines on the ground. + compas + We use the MinIMU-9 v6 Gyro as a compas. This is a backup to locate the goal in case the camere does not work. + + teensy + We are using the teensy 4.1 as main microconrtoller that directs all components. + port multiplexer + We are using the MCP23017 as a IO expanter becouse the teensy does not have enough ports. + i2c multiplexer + We are using the pca9548a as i2c multiplexer becouse the color sensors do not have customisable i2c addreses and thus need to have a device that lets us read them all . + Netherlands + + + diff --git a/upper_connection_schema.pdf b/upper_connection_schema.pdf index 490a60f..c598008 100644 Binary files a/upper_connection_schema.pdf and b/upper_connection_schema.pdf differ -- cgit v1.2.3