        <style>
            #donation_buttons td{
                border:medium none;
                background: inherit !important;
            }
            #donation_buttons table{               
                border:medium none;
                margin: auto;
                width: auto;
            }
        </style>
        {"id":4914,"date":"2019-08-19T12:54:52","date_gmt":"2019-08-19T12:54:52","guid":{"rendered":"http:\/\/rogerbit.com\/wprb\/?p=4914"},"modified":"2019-08-19T12:54:52","modified_gmt":"2019-08-19T12:54:52","slug":"elegir-y-colocar-con-robot-delta-controlado-por-arduino-mega","status":"publish","type":"post","link":"https:\/\/rogerbit.com\/wprb\/2019\/08\/elegir-y-colocar-con-robot-delta-controlado-por-arduino-mega\/","title":{"rendered":"Elegir y colocar con Robot Delta (Controlado por Arduino Mega)"},"content":{"rendered":"<p>Un robot delta controlado por Arduino construido con fischertechnik: robot de recogida y colocaci\u00f3n r\u00e1pido y preciso.<\/p>\n<div style=\"width: 800px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-4914-1\" width=\"800\" height=\"600\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2019\/08\/uploads2ftmp2f60e73e72-a72a-4aa8-b973-db1d06f702d52fdelta4_ZvwN4mkFxp.mp4?_=1\" \/><a href=\"http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2019\/08\/uploads2ftmp2f60e73e72-a72a-4aa8-b973-db1d06f702d52fdelta4_ZvwN4mkFxp.mp4\">http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2019\/08\/uploads2ftmp2f60e73e72-a72a-4aa8-b973-db1d06f702d52fdelta4_ZvwN4mkFxp.mp4<\/a><\/video><\/div>\n<div class=\"project-section-title\">\n<hr \/>\n<p>Tal vez pueda interesarte proyectos en arduino, pic, rob\u00f3tica, telecomunicaciones, suscribete en\u00a0<a href=\"http:\/\/www.youtube.com\/user\/carlosvolt?sub_confirmation=1\">http:\/\/www.youtube.com\/user\/carlosvolt?sub_confirmation=1<\/a>\u00a0mucho videos con c\u00f3digo fuentes completos y diagramas<\/p>\n<div id=\"ubm-banners-rotation-n1\" data-interval=\"4000\" class=\"ubm_banners_rotation\" style=\"overflow: hidden; width: 200px; height: 150px;\"><div id=\"3_ubm_banner\" class=\"ubm_rotating_banner\"><a href=\"https:\/\/bit.ly\/3aXRDAu\" target=\"_blank\" rel=\"dofollow\"><img src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/useful_banner_manager_banners\/3-2-logo youtube.png\" width=\"100%\" height=\"100%\" alt=\"SUSCRIBETE A NUESTRO CANAL DE YOUTUBE, TUTORIALES GRATIS\" \/><\/a><\/div><\/div>\n<hr \/>\n<h2 class=\"hckui__typography__h2 title-with-anchor\">Cosas usadas en este proyecto<\/h2>\n<\/div>\n<div class=\"project-parts\">\n<div><\/div>\n<div class=\"view-expanded\">\n<table class=\"project-parts-table\">\n<tbody>\n<tr class=\"head\">\n<td colspan=\"6\">\n<h3 class=\"hckui__typography__h3\">Componentes de hardware<\/h3>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"part-img\"><\/td>\n<td>\n<table>\n<tbody>\n<tr>\n<td class=\"hckui__typography__bodyL\"><a class=\"hckui__typography__linkBlue\" href=\"https:\/\/www.hackster.io\/arduino\/products\/arduino-mega-2560-genuino-mega-2560?ref=project-3eff40\" data-ha=\"{&quot;eventName&quot;:&quot;Clicked link&quot;,&quot;customProps&quot;:{&quot;value&quot;:&quot;Arduino Mega 2560 \\u0026 Genuino Mega 2560&quot;,&quot;href&quot;:&quot;\/arduino\/products\/arduino-mega-2560-genuino-mega-2560?ref=project-3eff40&quot;,&quot;type&quot;:&quot;part&quot;,&quot;location&quot;:&quot;things&quot;},&quot;clickOpts&quot;:{&quot;delayRedirect&quot;:true}}\">Arduino Mega 2560 y Genuino Mega 2560<\/a><\/td>\n<\/tr>\n<tr>\n<td class=\"hckui__typography__bodyS hckui__typography__pebble hckui__typography__breakWord\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<td class=\"hckui__typography__bodyL times\">\u00d7<\/td>\n<td class=\"hckui__typography__bodyL quantity\">1<\/td>\n<td class=\"actions\">\n<div class=\"hckui__buttons__group\"><\/div>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"part-img\"><\/td>\n<td>\n<table>\n<tbody>\n<tr>\n<td class=\"hckui__typography__bodyL\">Motor paso a paso, mini paso<\/td>\n<\/tr>\n<tr>\n<td class=\"hckui__typography__bodyS hckui__typography__pebble hckui__typography__breakWord\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<td class=\"hckui__typography__bodyL times\">\u00d7<\/td>\n<td class=\"hckui__typography__bodyL quantity\">3<\/td>\n<td class=\"actions\">\n<div class=\"hckui__buttons__group\"><\/div>\n<\/td>\n<\/tr>\n<tr class=\"head\">\n<td colspan=\"6\">\n<h3 class=\"hckui__typography__h3\">Aplicaciones de software y servicios en l\u00ednea.<\/h3>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"part-img\"><\/td>\n<td>\n<table>\n<tbody>\n<tr>\n<td class=\"hckui__typography__bodyL\"><a class=\"hckui__typography__linkBlue\" href=\"https:\/\/www.hackster.io\/arduino\/products\/arduino-ide?ref=project-3eff40\" data-ha=\"{&quot;eventName&quot;:&quot;Clicked link&quot;,&quot;customProps&quot;:{&quot;value&quot;:&quot;Arduino IDE&quot;,&quot;href&quot;:&quot;\/arduino\/products\/arduino-ide?ref=project-3eff40&quot;,&quot;type&quot;:&quot;part&quot;,&quot;location&quot;:&quot;things&quot;},&quot;clickOpts&quot;:{&quot;delayRedirect&quot;:true}}\">IDE Arduino<\/a><\/td>\n<\/tr>\n<tr>\n<td class=\"hckui__typography__bodyS hckui__typography__pebble hckui__typography__breakWord\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<td colspan=\"2\"><\/td>\n<td class=\"actions\"><\/td>\n<\/tr>\n<tr>\n<td class=\"part-img\"><\/td>\n<td>\n<table>\n<tbody>\n<tr>\n<td class=\"hckui__typography__bodyL\"><a class=\"hckui__typography__linkBlue\" href=\"https:\/\/www.hackster.io\/arduino\/products\/arduino-web-editor?ref=project-3eff40\" data-ha=\"{&quot;eventName&quot;:&quot;Clicked link&quot;,&quot;customProps&quot;:{&quot;value&quot;:&quot;Arduino Web Editor&quot;,&quot;href&quot;:&quot;\/arduino\/products\/arduino-web-editor?ref=project-3eff40&quot;,&quot;type&quot;:&quot;part&quot;,&quot;location&quot;:&quot;things&quot;},&quot;clickOpts&quot;:{&quot;delayRedirect&quot;:true}}\">Arduino Web Editor<\/a><\/td>\n<\/tr>\n<tr>\n<td class=\"hckui__typography__bodyS hckui__typography__pebble hckui__typography__breakWord\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<td colspan=\"2\"><\/td>\n<td class=\"actions\"><\/td>\n<\/tr>\n<tr>\n<td class=\"part-img\"><\/td>\n<td>\n<table>\n<tbody>\n<tr>\n<td class=\"hckui__typography__bodyL\"><a class=\"hckui__typography__linkBlue\" href=\"https:\/\/www.hackster.io\/microsoft\/products\/visual-studio-code-extension-for-arduino?ref=project-3eff40\" data-ha=\"{&quot;eventName&quot;:&quot;Clicked link&quot;,&quot;customProps&quot;:{&quot;value&quot;:&quot;Microsoft Visual Studio Code Extension for Arduino&quot;,&quot;href&quot;:&quot;\/microsoft\/products\/visual-studio-code-extension-for-arduino?ref=project-3eff40&quot;,&quot;type&quot;:&quot;part&quot;,&quot;location&quot;:&quot;things&quot;},&quot;clickOpts&quot;:{&quot;delayRedirect&quot;:true}}\">Extensi\u00f3n de c\u00f3digo de Microsoft Visual Studio para Arduino<\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<table class=\"project-parts-table\">\n<tbody>\n<tr class=\"head\">\n<td colspan=\"6\">\n<h3 class=\"hckui__typography__h3\">Herramientas manuales y m\u00e1quinas de fabricaci\u00f3n.<\/h3>\n<\/td>\n<\/tr>\n<tr>\n<td class=\"part-img\"><\/td>\n<td>\n<table>\n<tbody>\n<tr>\n<td class=\"hckui__typography__bodyL\">Impresora 3D (gen\u00e9rica)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div class=\"project-section-title\">\n<h2 class=\"hckui__typography__h2 title-with-anchor\">Historia<\/h2>\n<\/div>\n<div class=\"project-story collapsible-section collapsed hljs-active hljs-monokai\">\n<p class=\"hckui__typography__bodyL\">La construcci\u00f3n de robots industriales no significa necesariamente gastar mucho dinero en hardware costoso.\u00a0Construido con fischertechnik (un juguete de construcci\u00f3n originario de Alemania) y controlado por un Arduino Mega, este robot delta es una m\u00e1quina bastante simple.\u00a0Sin embargo, no le falta velocidad ni precisi\u00f3n para cumplir su trabajo: el robot recoge los elementos de una cinta transportadora y los clasifica por color de forma similar a los robots industriales de recogida y colocaci\u00f3n.<\/p>\n<p><iframe loading=\"lazy\" width=\"1160\" height=\"653\" src=\"https:\/\/www.youtube.com\/embed\/2Me_oyMifoU?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p>Delta Robot como robot de pick and place<\/p>\n<p class=\"hckui__typography__bodyL\"><strong>\u00bfCu\u00e1les son los principales desaf\u00edos de este proyecto?<\/strong><\/p>\n<ul class=\"hckui__typography__bodyL\">\n<li><em>Cinem\u00e1tica del robot Delta<\/em><\/li>\n<li><em>Seguimiento de movimiento de art\u00edculos en el transportador<\/em><\/li>\n<li><em>Agarre al vac\u00edo<\/em><\/li>\n<\/ul>\n<h3 id=\"toc-delta-robot-kinematics-0\" class=\"hckui__typography__h3 title-with-anchor\"><i class=\"fa fa-link\"><\/i>Cinem\u00e1tica del robot Delta<\/h3>\n<p class=\"hckui__typography__bodyL\">A diferencia de la cinem\u00e1tica simple como la cinem\u00e1tica lineal que a menudo se usa en impresoras 3D, la cinem\u00e1tica del robot delta es m\u00e1s complicada y no es f\u00e1cil de entender. Para controlar un robot delta con coordenadas cartesianas, se requiere la llamada cinem\u00e1tica inversa.\u00a0Implement\u00e9 la cinem\u00e1tica inversa para los robots delta de acuerdo con un art\u00edculo publicado por Robert L. Williams II:\u00a0<a class=\"hckui__typography__linkBlue\" href=\"https:\/\/www.google.com\/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;ved=2ahUKEwiiqIjthNfjAhWSKFAKHaGKBmgQFjAAegQIAxAC&amp;url=https%3A%2F%2Fwww.researchgate.net%2Ffile.PostFileLoader.html%3Fid%3D58bd7d14404854027f09f5d0%26assetKey%3DAS%253A468931250003970%25401488813330544&amp;usg=AOvVaw0Oo0rqeEh0Vn9PfQW8nFgK\" rel=\"nofollow\" data-ha=\"{&quot;eventName&quot;:&quot;Clicked link&quot;,&quot;customProps&quot;:{&quot;value&quot;:&quot;\\u0026#34;The Delta Parallel Robot: Kinematics Solutions\\u0026#34; &quot;,&quot;href&quot;:&quot;https:\/\/www.google.com\/url?sa=t\\u0026rct=j\\u0026q=\\u0026esrc=s\\u0026source=web\\u0026cd=1\\u0026ved=2ahUKEwiiqIjthNfjAhWSKFAKHaGKBmgQFjAAegQIAxAC\\u0026url=https%3A%2F%2Fwww.researchgate.net%2Ffile.PostFileLoader.html%3Fid%3D58bd7d14404854027f09f5d0%26assetKey%3DAS%253A468931250003970%25401488813330544\\u0026usg=AOvVaw0Oo0rqeEh0Vn9PfQW8nFgK&quot;,&quot;type&quot;:&quot;story&quot;,&quot;location&quot;:&quot;story&quot;},&quot;clickOpts&quot;:{&quot;delayRedirect&quot;:true}}\">&#8220;El robot paralelo Delta: Soluciones cinem\u00e1ticas&#8221;\u00a0<\/a>Aunque esto parece ser computacionalmente costoso, las cinem\u00e1ticas delta tienen algunas buenas ventajas sobre otras cinem\u00e1ticas de robots.\u00a0En primer lugar, son asombrosamente r\u00e1pidos y precisos, en segundo lugar, tienen un rango de funcionamiento bastante bueno.\u00a0Sin embargo, las vibraciones son un problema grave y la carga en movimiento debe ser lo m\u00e1s baja posible.<\/p>\n<p class=\"hckui__typography__bodyL\">El siguiente video le da una idea de lo que es posible con los robots delta:<\/p>\n<p><iframe loading=\"lazy\" width=\"1160\" height=\"653\" src=\"https:\/\/www.youtube.com\/embed\/WYtq_7WfIS0?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<section id=\"story\">\n<div class=\"project-story collapsible-section collapsed hljs-active hljs-monokai\">\n<p class=\"hckui__typography__bodyL\"><strong>Seguimiento de movimiento\u00a0<\/strong>La posici\u00f3n de cada elemento es capturada por una barrera de luz l\u00e1ser.\u00a0Esto le permite al robot saber cu\u00e1ndo el art\u00edculo ha pasado una cierta posici\u00f3n en el transportador.\u00a0Adem\u00e1s, la velocidad del transportador se mide leyendo una se\u00f1al del codificador.\u00a0Esto le permite al robot saber qu\u00e9 tan r\u00e1pido se mueve el art\u00edculo.\u00a0Dada esa informaci\u00f3n, el movimiento del robot se puede calcular para que elija el elemento en el momento adecuado.<\/p>\n<p class=\"hckui__typography__bodyL\"><strong>Pinza de vac\u00edo\u00a0<\/strong>Los art\u00edculos son manipulados por una pinza de vac\u00edo.\u00a0Como no tengo una bomba de vac\u00edo, he buscado otra soluci\u00f3n para esta tarea:<\/p>\n<p class=\"hckui__typography__bodyL\">Hay dos cilindros neum\u00e1ticos montados uno al lado del otro.\u00a0El primer cilindro est\u00e1 conectado a una v\u00e1lvula que deja entrar o sale la presi\u00f3n.\u00a0El segundo cilindro est\u00e1 conectado a una ventosa.\u00a0Cuando se aplica presi\u00f3n al primer cilindro, se extiende.\u00a0Como ambos pistones est\u00e1n mec\u00e1nicamente conectados entre s\u00ed, el movimiento del primer cilindro tambi\u00e9n obliga al segundo cilindro a extenderse.\u00a0Sin embargo, este movimiento genera un vac\u00edo dentro del segundo cilindro.\u00a0Este vac\u00edo se utiliza para recoger los art\u00edculos.<\/p>\n<h2 class=\"hckui__typography__h2 title-with-anchor\">Piezas personalizadas y cerramiento<\/h2>\n<section id=\"cad\">\n<div class=\"project-attachment\">\n<div class=\"header\">\n<div class=\"text\">\n<h3 class=\"hckui__typography__h3\">Pinza de vac\u00edo<\/h3>\n<div class=\"hckui__typography__bodyS hckui__typography__pebble\">Pinza de vac\u00edo Mouint<\/div>\n<\/div>\n<div class=\"actions\"><\/div>\n<\/div>\n<div class=\"embed widescreen\"><iframe loading=\"lazy\" width=\"100%\" height=\"100%\" allowfullscreen=\"allowfullscreen\" frameborder=\"0\" mozallowfullscreen=\"mozallowfullscreen\" src=\"https:\/\/sketchfab.com\/models\/77d7e457c9c3424083d2de09d3a3debb\/embed\" webkitallowfullscreen=\"webkitallowfullscreen\" data-mce-fragment=\"1\"><\/iframe><\/div>\n<\/div>\n<\/section>\n<div class=\"project-section-break\"><\/div>\n<section id=\"schematics\">\n<div class=\"project-section-title\">\n<h2 class=\"hckui__typography__h2 title-with-anchor\"><i class=\"fa fa-link\"><\/i>Esquemas<\/h2>\n<h3 class=\"hckui__typography__h3\">Arduino Mega Shield<\/h3>\n<div class=\"hckui__typography__bodyS hckui__typography__pebble\">tarjeta de circuito impreso<\/div>\n<div><a href=\"http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2019\/08\/uploads2ftmp2ff0ef069d-3eeb-4095-8de1-406df1c129cc2fimg_3671_pJxV6DTsCm.jpg\"><img loading=\"lazy\" class=\"alignnone size-large wp-image-4916\" src=\"http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2019\/08\/uploads2ftmp2ff0ef069d-3eeb-4095-8de1-406df1c129cc2fimg_3671_pJxV6DTsCm-1024x768.jpg\" alt=\"\" width=\"1024\" height=\"768\" srcset=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2019\/08\/uploads2ftmp2ff0ef069d-3eeb-4095-8de1-406df1c129cc2fimg_3671_pJxV6DTsCm-1024x768.jpg 1024w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2019\/08\/uploads2ftmp2ff0ef069d-3eeb-4095-8de1-406df1c129cc2fimg_3671_pJxV6DTsCm-300x225.jpg 300w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2019\/08\/uploads2ftmp2ff0ef069d-3eeb-4095-8de1-406df1c129cc2fimg_3671_pJxV6DTsCm-768x576.jpg 768w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2019\/08\/uploads2ftmp2ff0ef069d-3eeb-4095-8de1-406df1c129cc2fimg_3671_pJxV6DTsCm-600x450.jpg 600w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2019\/08\/uploads2ftmp2ff0ef069d-3eeb-4095-8de1-406df1c129cc2fimg_3671_pJxV6DTsCm-820x615.jpg 820w, https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2019\/08\/uploads2ftmp2ff0ef069d-3eeb-4095-8de1-406df1c129cc2fimg_3671_pJxV6DTsCm-1320x990.jpg 1320w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/div>\n<div>\n<pre class=\"lang:arduino decode:true \">#include &lt;TimerOne.h&gt; \r\n#include &lt;DeltaRobotKinematics.h&gt; \r\n#include &lt;MegaDueShield.h&gt; \r\n#define LOW_SPEED 50 #define MEDIUM_SPEED 80 #define MAX_SPEED 100 \/ * Pinza de vac\u00edo 1_1 de\r\n     junio de 2019     - control de presi\u00f3n\r\n     - velocidad del transportador adaptativo     julio 2019     - velocidad del transportador adaptativo\r\n julio 2019 pila\r\n     - filtro de color\r\n * \/\r\n DeltaRobotKinematics delta ; StepperMotor &amp; mot1 = * shield.getStepper ( 2 ) ; \/\/ preconfigurado paso a paso\r\n StepperMotor &amp; mot2 = * shield.getStepper (\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n  \r\n  1);\r\nStepperMotor mot3;  \/\/ half-bridge based stepper motor\r\n\r\nDCMotor coil31;\r\nDCMotor coil32;\r\n\r\nDCMotor conveyor;\r\nDCMotor gripper;\r\nDCMotor compressor;\r\nDCMotor laser;\r\nDCMotor separator;\r\n\r\nlong posM1 = 0;\r\nlong posM2 = 0;\r\nlong posM3 = 0;\r\n\r\nvolatile int posConveyor = 0;\r\nvolatile int pressure;\r\n\r\nconst uint8_t limitSwitch1 = I5;\r\nconst uint8_t limitSwitch2 = I6;\r\nconst uint8_t limitSwitch3 = I8;\r\n\r\nconst uint8_t conveyorEncoder = C3;\r\nconst uint8_t photocell = C4;\r\nconst uint8_t stack = D4;\r\nconst uint8_t MPX_pin = I3;\r\nconst uint8_t colorSensor = I4;\r\n\r\nconst int whiteLowerThreshold = 100;\r\nconst int whiteUpperThreshold = 175;\r\nconst int redLowerThreshold = 196;\r\nconst int redUpperThreshold = 270;\r\nconst int blueLowerThreshold = 480;\r\nconst int blueUpperThreshold = 510;\r\n\r\nbool pass = false;\r\nlong passTime = 0;\r\n\r\nuint8_t currentSpeedProfile = LOW_SPEED;\r\n\r\n\r\nvoid pressureControl()\r\n{\r\n  pressure = analogRead(MPX_pin);\r\n  if (compressor.getSpeed() &lt; 1)\r\n  {\r\n    \r\n    if (pressure &lt; 140)\r\n    {\r\n      compressor.on();\r\n    }\r\n  }\r\n  else\r\n  {\r\n    if (pressure &gt; 187)\r\n    {\r\n      compressor.off();\r\n    }\r\n  }\r\n}\r\n\r\nint rad2StepM1(double radian)\r\n{\r\n  return (int) ((radian + 0.785) * 95.51);\r\n}\r\nint rad2StepM2(double radian)\r\n{\r\n  return (int) ((radian + 0.785) * 127.35);\r\n}\r\nint rad2StepM3(double radian)\r\n{\r\n  return (int) ((radian + 0.785) * 127.35);\r\n}\r\n\r\nvoid posP2P(double x, double y, double z)\r\n{\r\n  delta.inverseKinematics(x, y, z);\r\n  bool t = false;\r\n  while (!t)\r\n  {\r\n    t = mot1.stepping(posM1, rad2StepM1(delta.getPhi2()));\r\n    t &amp;= mot2.stepping(posM2, rad2StepM2(delta.getPhi3()));\r\n    t &amp;= mot3.stepping(posM3, rad2StepM3(delta.getPhi1()));\r\n  }\r\n}\r\n\r\nvoid posCP(double x1, double y1, double z1, double x2, double y2, double z2)\r\n{\r\n  posP2P(x1, y1, z1);\r\n  double vect[] = {x2 - x1, y2 - y1, z2 - z1};\r\n  double vectLength = sqrt(pow(vect[0], 2) + pow(vect[1], 2) + pow(vect[2], 2));\r\n  double unitVect[3];\r\n  for (int i = 0; i &lt; 3; i++)\r\n  {\r\n    unitVect[i] = vect[i] \/ vectLength \/ 2.0; \/\/ unitVect: Length 0.5mm\r\n  }\r\n  vect[0] = x1;\r\n  vect[1] = y1;\r\n  vect[2] = z1;\r\n  int iterations = vectLength * 2; \/\/ equivalent to vectLength \/ 0.5\r\n  for (int i = 0; i &lt; iterations; i++)\r\n  {\r\n    vect[0] += unitVect[0];\r\n    vect[1] += unitVect[1];\r\n    vect[2] += unitVect[2];\r\n    posP2P(vect[0], vect[1], vect[2]);\r\n  }\r\n  posP2P(x2, y2, z2);\r\n\r\n\r\n}\r\n\r\nvoid speedProfile(int profile)\r\n{\r\n  mot1.velocity(profile);\r\n  mot2.velocity(profile);\r\n  mot3.velocity(profile);\r\n}\r\n\r\nint colorDetection()\r\n{\r\n  int n = 4; \/\/ #of measurements\r\n  long measurements[n];\r\n  for (int i = 0; i &lt; n; i++)\r\n  {\r\n    measurements[i] = analogRead(colorSensor);\r\n    delay(30);\r\n  }\r\n  \/\/ calc average\r\n  long avg = 0;\r\n  for (int i = 0; i &lt; n; i++)\r\n  {\r\n    avg += measurements[i];\r\n  }\r\n  avg \/= n;\r\n  \/\/ calc error\r\n  long error = 0;\r\n  for (int i = 0; i &lt; n; i++)\r\n  {\r\n    error += (avg-measurements[i])*(avg-measurements[i]);\r\n  }\r\n  Serial.print(\"Error: \");\r\n  error \/= n;\r\n  Serial.println(error);\r\n\r\n  if (error &lt; 3)\r\n  {\r\n    \/\/ measurement accurate, return average\r\n    Serial.println(avg);\r\n    return avg;\r\n  }\r\n  else\r\n  {\r\n    \/\/ measurement inaccurate, return 1023\r\n    return 1023;\r\n  }\r\n}\r\n\r\nvoid referencing()\r\n{\r\n  delay(50);\r\n  bool ref = false;\r\n  while (!ref)\r\n  {\r\n    ref = mot1.referencing(posM1);\r\n    ref &amp;= mot2.referencing(posM2);\r\n    ref &amp;= mot3.referencing(posM3);\r\n  }\r\n  delay(50);\r\n}\r\n\r\n\/\/ ISR\r\nvoid conveyorISR()\r\n{\r\n  posConveyor++;\r\n}\r\n\r\nvoid setup() {\r\n  Serial.begin(115200);\r\n  Serial.println(\"Delta Robot @ MegaDueShield\");\r\n\r\n  delta.setUpperLegsLength(75);\r\n  delta.setLowerLegsLength(180);\r\n  delta.setBaseSize(41.83);\r\n  delta.setPlatformSize(26);\r\n\r\n  coil31 = *shield.getDCMotor(5);\r\n  coil32 = *shield.getDCMotor(6);\r\n\r\n  conveyor = *shield.getDCMotor(1);\r\n  gripper = *shield.getDCMotor(7);\r\n  compressor = *shield.getDCMotor(8);\r\n  laser = *shield.getDCMotor(2);\r\n  separator = *shield.getDCMotor(4);\r\n\r\n  mot3.setHalfBridge(coil31, coil32);\r\n\r\n  mot1.motorConfig(200, 80, 600, 400);\r\n  mot2.motorConfig(200, 120, 800, 400);\r\n  mot3.motorConfig(200, 60, 800, 400);\r\n\r\n  mot1.attachLimitSwitch(limitSwitch1);\r\n  mot2.attachLimitSwitch(limitSwitch2);\r\n  mot3.attachLimitSwitch(limitSwitch3);\r\n\r\n  pinMode(photocell, INPUT_PULLUP);\r\n  pinMode(stack, INPUT_PULLUP);\r\n  pinMode(conveyorEncoder, INPUT_PULLUP);\r\n  attachInterrupt(digitalPinToInterrupt(conveyorEncoder), conveyorISR, CHANGE);\r\n\r\n  shield.rgb(0, 0, 150);\r\n  delay(200);\r\n  shield.rgbOff();\r\n\r\n  referencing();\r\n  delay(500);\r\n\r\n  speedProfile(80);\r\n  laser.on();\r\n\r\n  \r\n  Timer1.initialize(300000);  \r\n  Timer1.attachInterrupt(pressureControl);  \r\n}\r\n\r\nvoid loop() {\r\n  mot1.release();\r\n  mot2.release();\r\n  mot3.release();\r\n\r\n  while (!digitalRead(stack))\r\n  {\r\n    \/\/ no item in stock\r\n    if (!pass)\r\n    {\r\n       conveyor.off();\r\n    }\r\n    else\r\n    {\r\n      if ((millis() - passTime) &gt; 2000)\r\n      {\r\n        \/\/ conveyor on until white item has passed\r\n        pass = false;\r\n      }\r\n    } \r\n    delay(300);  \r\n  }\r\n  pass = false;\r\n  conveyor.cw(135);\r\n  delay(400);\r\n  \r\n  int colorVal = 1023;\r\n  while (colorVal &gt; 1000)\r\n  {\r\n    colorVal= colorDetection();\r\n  }\r\n  \/\/ separate\r\n  separator.on();\r\n  delay(80);\r\n  separator.off();\r\n\r\n  if (colorVal &lt; whiteUpperThreshold)\r\n  {\r\n    \/\/ color is white\r\n    delay(300);\r\n    pass = true;\r\n    passTime = millis();\r\n  }\r\n  else\r\n  {\r\n    \/\/ color is either red or blue, remove item from conveyor\r\n    delay(20); \/\/ wait to prevent light barrier from triggering falsely\r\n    while (!digitalRead(photocell))\r\n    {\r\n\r\n    }\r\n    posConveyor = 0;\r\n    long t0 = millis();\r\n\r\n    while (posConveyor &lt; 140)\r\n    {}\r\n    long t1 = millis();\r\n\r\n    double xTrig = 285.0 - 37940.0 \/ (t1 - t0);\r\n\r\n    while (posConveyor &lt; xTrig)\r\n    {\r\n    }\r\n\r\n\r\n    long t = millis();\r\n    posP2P(-18, 10, -165);\r\n    long t2 = millis();\r\n    \/\/delay(4000);\r\n    \/\/posCP(-21, 10, -167, -21, 10, -176);\r\n    posP2P(-18, 10, -176);\r\n    long t3 = millis();\r\n\r\n    gripper.on();\r\n    delay(200);\r\n    \r\n\r\n    \/\/ choose where to place the item based on color\r\n    if (colorVal &lt; blueLowerThreshold)\r\n    {\r\n      \/\/ color is red\r\n      posP2P(0, 0, -160);\r\n      posP2P(60, 0, -160);\r\n    }\r\n    else\r\n    {\r\n      \/\/ color is blue\r\n      posP2P(-20, 30, -160);\r\n      posP2P(-70, -20, -160);\r\n    }\r\n     gripper.off () ;     retraso ( 300 ) ;     posP2P ( 0 , 0 , -140 ) ;     referenciando () ; } }\r\n\r\n\r\n    \r\n\r\n\r\n  \r\n<\/pre>\n<p><a href=\"https:\/\/www.hackster.io\/ArduinoFT\/pick-and-place-delta-robot-controlled-by-arduino-mega-3eff40\">Fuente<\/a><\/p>\n<hr \/>\n<p>SUSCRIBETE A NUESTROS BOLETINES, RECIBE EN TU CORREO LAS NOTICIAS M\u00c1S DESTACADAS, S\u00d3LO INGRESANDO TU CORREO ELECTR\u00d3NICO<\/p>\n<p>[wysija_form id=&#8221;1&#8243;]<\/p>\n<hr \/>\n<div class=\"page-sidebar widget\" id=\"donation_buttons\"><form action=\"https:\/\/www.paypal.com\/cgi-bin\/webscr\" method=\"post\" target=\"_blank\" ><input type=\"hidden\" name=\"business\" value=\"donacion@rogerbit.com\"><input type=\"hidden\" name=\"bn\" value=\"mbjtechnolabs_SP\"><input type=\"hidden\" name=\"cmd\" value=\"_donations\"><input type=\"hidden\" name=\"item_name\" value=\"Ayuda a RogerBit.com\"><input type=\"hidden\" name=\"item_number\" value=\"www.rogerbit.com\"><input type=\"hidden\" class=\"set_donation_button_amount\" name=\"amount\" value=\"1\"><table ><tbody><tr><td><label for=\"rogerBit necesita de tu ayuda para seguir existiendo :-)\">rogerBit necesita de tu ayuda para seguir existiendo :-)<\/label><\/td><\/tr><\/tbody><\/table><table ><tbody><tr><td><input style=\"margin-top:10px;\" type=\"image\" name=\"submit\" border=\"0\" src=\"https:\/\/www.paypal.com\/en_US\/i\/btn\/btn_donateCC_LG.gif\" alt=\"PayPal - The safer, easier way to pay online\"><\/td><\/tr><\/tbody><\/table><input type=\"hidden\" name=\"currency_code\" value=\"USD\"><input type=\"hidden\" name=\"notify_url\" value=\"https:\/\/rogerbit.com\/wprb\/?Donation_Button&#038;action=ipn_handler\"><\/form><\/div>\n<hr \/>\n<p><strong>VIDEO RECOMENDADO<\/strong><\/p>\n<p><iframe loading=\"lazy\" width=\"1160\" height=\"653\" src=\"https:\/\/www.youtube.com\/embed\/xdcbqgPGznk?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<\/div>\n<\/div>\n<\/section>\n<\/div>\n<\/section>\n<\/div>\n<\/div>\n<\/div>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Un robot delta controlado por Arduino construido con fischertechnik: robot de recogida y colocaci\u00f3n r\u00e1pido y preciso. Tal vez pueda interesarte proyectos en arduino, pic, rob\u00f3tica, telecomunicaciones, suscribete en\u00a0http:\/\/www.youtube.com\/user\/carlosvolt?sub_confirmation=1\u00a0mucho videos con c\u00f3digo fuentes completos y diagramas Cosas usadas en este proyecto Componentes de hardware Arduino Mega 2560 y Genuino Mega 2560 \u00d7 1 Motor paso [&hellip;]<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":4917,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[],"_links":{"self":[{"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/posts\/4914"}],"collection":[{"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/comments?post=4914"}],"version-history":[{"count":1,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/posts\/4914\/revisions"}],"predecessor-version":[{"id":4918,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/posts\/4914\/revisions\/4918"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/media\/4917"}],"wp:attachment":[{"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/media?parent=4914"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/categories?post=4914"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/tags?post=4914"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}