João Andrade
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Desafio 24/08 [TOC] ## Grupo 1 ### GitLab ![](https://i.imgur.com/m3l38pE.png) ### Simulação do TinkerCAD https://www.tinkercad.com/things/b80YvviIINh ```cpp= const int ledVermelho = 6; const int ledAzul = 5; const int ultrassomEsquerdaTrigger = 11; const int ultrassomEsquerdaEcho = 8; const int ultrassomDireitaTrigger = 10; const int ultrassomDireitaEcho = 7; float distanciaEsquerda = 0; float distanciaDireita = 0; unsigned long microsLedVermelho; unsigned long microsLedAzul; void AcenderLedAzul(); void AcenderLedVermelho(); void ApagarLedAzul(); void ApagarLedVermelho(); float distUltrassomDireito(); float distUltrassomEsquerdo(); bool objetoNaDireita(); bool objetoNaEsquerda(); float brilhoAnalog(); unsigned long tempo; double distancia; void setup(){ Serial.begin(9600); pinMode(ledVermelho, OUTPUT); pinMode(ledAzul, OUTPUT); pinMode(ultrassomEsquerdaTrigger,OUTPUT); pinMode(ultrassomEsquerdaEcho,INPUT); pinMode(ultrassomDireitaTrigger,OUTPUT); pinMode(ultrassomDireitaEcho,INPUT); digitalWrite(ultrassomEsquerdaTrigger, LOW); digitalWrite(ultrassomDireitaTrigger,LOW); } void loop(){ //distanciaDireita = distUltrassomDireito(); //distanciaEsquerda = distUltrassomEsquerdo(); digitalWrite(ultrassomDireitaTrigger, HIGH); microsLedAzul = micros(); digitalWrite(ultrassomEsquerdaTrigger, HIGH); microsLedVermelho = micros(); analogWrite(ledAzul, brilhoAnalog(distanciaDireita)); analogWrite(ledVermelho, brilhoAnalog(distanciaEsquerda)); if (micros() - microsLedVermelho > 10){ digitalWrite(ultrassomEsquerdaTrigger, LOW); tempo = pulseIn(ultrassomEsquerdaEcho, HIGH); distanciaEsquerda = tempo/58; } if (micros() - microsLedAzul > 10){ digitalWrite(ultrassomDireitaTrigger, LOW); tempo = pulseIn(ultrassomDireitaEcho, HIGH); distanciaDireita = tempo/58; } } /*float distUltrassomDireito(){ digitalWrite(ultrassomDireitaTrigger, HIGH); microsLedAzul = micros(); delayMicroseconds(10); digitalWrite(ultrassomDireitaTrigger, LOW); tempo = pulseIn(ultrassomDireitaEcho, HIGH); distanciaDireita = tempo/58; return distancia; } float distUltrassomEsquerdo(){ digitalWrite(ultrassomEsquerdaTrigger, HIGH); microsLedVermelho = micros(); //delayMicroseconds(10); //digitalWrite(ultrassomEsquerdaTrigger, LOW); //tempo = pulseIn(ultrassomEsquerdaEcho, HIGH); //distancia = tempo/58; //return distancia; } */ float brilhoAnalog(float distancia){ if(distancia>=2.1 && distancia<=70.1){ return 255-(distancia*(255/70)); }else{ return 0; } } bool objetoNaEsquerda(float distancia){ if(distancia > 2.1 && distancia < 70){ return true; }else{ return false; } } ``` ### Feedback Grupo 1 * - Projeto não está no git * - O git poderia ser mais organizado * + Circuito bem feito * + Variáveis e funções com nomes intuitivos * + Identadinho * - Nenhum comentário no código * + Se preocuparam com as tipagens certas * + Código em português * --- Usaram pulseIn ao invés de delay, isso PARA o código esperando o sinal voltar. (PÉSSIMO PRO ROBÔ!!!) * ----- Não usaram attachInterrupt!!!! * - Alguns números poderiam ser substituídos por variáveis ou contantes, número no código é ruim. * + Usaram PWM o que é de acordo com o desafio mas não tiveram cuidado de colocar entre 0 e 255. * Não entendi a lógica do código de vocês, a distância não ta em função dos calculos de micros porque o pulseIn não usa essas variáveis definidas por vocês logo o If é inútil e vocês sempre entram neles. Recomendo revisar as aulas. ### PCB do Altium https://gitlab.com/MinervaBots/ps/processo-seletivo-2022-2/grupo-1/altium - Entrega devia ser o .PrjPbc junto com o .PcbDoc e .SchDoc e as bibliotecas -> Esquemático + Boa organização do esquemático -- Melhorar o nome das netlabes + Bateria ok, tentem melhorar o conector dela + Regulador, lembre-se que não temos tantos disponíveis na sala ok + Led ok ++ Botao com pull dwon + sensor de cor ok + sensor ultra som ok - DRV faltou os pinos de sense + Motores ok -> PCB - organizar melhor os componentes - posicionar melhor o arduino - aumentar o tamanho das trilhas - cortar a placa e fazer malha ## Grupo 2 ## GitLab ![](https://i.imgur.com/aZsq47k.png) ### Simulação do TinkerCAD ```cpp= // C++ code // // Variaveis globais da pinagem dos sensores ultrassonicos e dos leds int triggerPin2 = 12; int triggerPin3 = 13; int ledPin2 = 9; int ledPin3 = 10; int echoPin2 = 2; int echoPin3 = 3; // Variaveis globais para realizar a operacao necessaria para sabermos a largura do pulso int risingTimePin2; int risingTimePin3; int pulseTimePin2; int pulseTimePin3; // Criando as funcoes para o uso dentro das funcoes Rising void echoPin2Falling(); void echoPin3Falling(); // Funcao de rising do echo conectado ao pino 2 do arduino void echoPin2Rising(){ risingTimePin2 = millis(); attachInterrupt(digitalPinToInterrupt(echoPin2), echoPin2Falling, FALLING); } // Funcao de falling do echo conectado ao pino 2 do arduino void echoPin2Falling(){ pulseTimePin2 = millis() - risingTimePin2; attachInterrupt(digitalPinToInterrupt(echoPin2), echoPin2Rising, RISING); } // Funcao de rising do echo conectado ao pino 3 do arduino void echoPin3Rising(){ risingTimePin3 = millis(); attachInterrupt(digitalPinToInterrupt(echoPin3), echoPin3Falling, FALLING); } // Funcao de falling do echo conectado ao pino 3 do arduino void echoPin3Falling(){ pulseTimePin3 = millis() - risingTimePin3; attachInterrupt(digitalPinToInterrupt(echoPin3), echoPin3Rising, RISING); } void setup(){ // Definindo os pinos de entrada com seus respectivos modos pinMode(triggerPin2, OUTPUT); pinMode(triggerPin3, OUTPUT); pinMode(ledPin2, OUTPUT); pinMode(ledPin3, OUTPUT); pinMode(echoPin2, INPUT); pinMode(echoPin3, INPUT); // Configurando a interrupcao attachInterrupt(digitalPinToInterrupt(echoPin2), echoPin2Rising, RISING); attachInterrupt(digitalPinToInterrupt(echoPin3), echoPin3Rising, RISING); } void loop(){ //Acionando o led laranja quando a duracao do pulso for menor que milisegundos if (pulseTimePin2 < 50000) { digitalWrite(ledPin2, HIGH); } //Desligando o led laranja quando a duracao do pulso for maior que milisegundos else { digitalWrite(ledPin2, LOW); } //Acionando o led verde quando a duracao do pulso for menor que milisegundos if (pulseTimePin3 < 50000) { digitalWrite(ledPin3, HIGH); } //Desligando o led verde quando a duracao do pulso for maior que milisegundos else { digitalWrite(ledPin3, LOW); } } ``` > -. pinMode do echo no void setup está esquisito, pois está setado como Input. > -. O problema do código está no fato de que o pino Trigger nunca é desligado para haver uma atualização do tempo entre disparos das ondas do sensor. Assim, o Led nunca indica uma descida no sinal do sensor e sempre ficará aceso. > -. Quanto a boas práticas, o nome das variáveis de trigger e echo dos sensores está confuso, pois dentro da variável tem o pino para a qual se refere. Porque não chamar só de "sensor 1" e "sensor 2"? > +. Tirando o nome dessas variáveis, código bem comentado. > +. layout do projeto no TinkerCad bem organizado > -. Não usaram PWM no pino do LED ### PCB do Altium ---- Esquematico somente com o arduino e sem organização geral dos componentes ---- Falta DRV, sensores, atuadores e tudo mais + Arduino ok - Malha sem trilha ? https://gitlab.com/MinervaBots/ps/processo-seletivo-2022-2/grupo-2/grupo-2-info/altium/esquematico-placa-projetopratico ## Grupo 3 ## GitLab ![](https://i.imgur.com/21MvmfM.png) ### Simulação do TinkerCAD ```cpp= // define os pinos dos sensores ultrassonicos #define pino_trig 4 #define sensor1 2 #define sensor2 3 // define os pinos dos leds utilizados #define led1 6 #define led2 7 // variaveis usadas nos ISRs unsigned long int tempo_rising1; unsigned long int tempo_rising2; unsigned int tempo_echo1; unsigned int tempo_echo2; // validando função para utilizaçao void echo_falling(); // funçao envia comando para os triggers void envia_trigger() { digitalWrite(pino_trig, HIGH); delayMicroseconds(10); digitalWrite(pino_trig, LOW); } // salva o tempo do sinal e funçao ISR para a subida do sinal ECHO do sensor1 void echo_rising() { tempo_rising1 = micros(); attachInterrupt(digitalPinToInterrupt(sensor1), echo_falling, FALLING); } // salva o tempo do sinal e funçao ISR para a subida do sinal ECHO do sensor2 void echo_rising2() { tempo_rising2 = micros(); attachInterrupt(digitalPinToInterrupt(sensor2), echo_falling2, FALLING); } // calcula o tempo de recebimento do sinal ECHO e funçao ISR de descida do sinal ECHO do sensor1 void echo_falling() { tempo_echo1 = micros() - tempo_rising1; attachInterrupt(digitalPinToInterrupt(sensor1), echo_rising, RISING); envia_trigger(); } // calcula o tempo de recebimento do sinal ECHO e funçao ISR de descida do sinal ECHO do sensor2 void echo_falling2() { tempo_echo2 = micros() - tempo_rising2; attachInterrupt(digitalPinToInterrupt(sensor2), echo_rising2, RISING); envia_trigger(); } // define os pinos e inicia o serial para validaçao da distancia void setup() { Serial.begin(9600); pinMode(pino_trig, OUTPUT); pinMode(sensor1, INPUT); pinMode(sensor2, INPUT); pinMode(led1, OUTPUT); pinMode(led2, OUTPUT); attachInterrupt(digitalPinToInterrupt(sensor1), echo_rising, RISING); attachInterrupt(digitalPinToInterrupt(sensor2), echo_rising2, RISING); envia_trigger(); } // executa o codigo em loop void loop() { digitalWrite(led1, LOW); digitalWrite(led2, LOW); //condiçao de açao baseada em uma distancia arbitraria (77.3 cm) para o sensor1 if (tempo_echo1 < 4285){ digitalWrite(led1, HIGH); } //condiçao de açao baseada em uma distancia arbitraria (77.3 cm) para o sensor2 if (tempo_echo2 < 4285){ digitalWrite(led2, HIGH); } // Serial.println(tempo_echo2); } ``` > +. Código funcionando como deveria! > +. Código em portugues e bem comentado > -. No final do código na checagem da "condição de ação", tem que fazer matemática para entender a variável de comparação dos tempos do echo > +. layout bom no TinkerCad > -. Não usaram PWM no pino do LED > -. Não está no git! > -. Mesmo por uma quantidade de tempo que não fará muita diferença, usaram a função delayMicrosseconds() em vez de usar micros() no código todo. ### PCB do Altium https://gitlab.com/MinervaBots/ps/processo-seletivo-2022-2/grupo-3/entrega-parcial-23-08/altium -> Esquematico - Faltam Netlabels intuitivas + Bat, só atenção com o conector + Reg ok + led ok - botão sem pull up ou pull down - Faltou ligar sense A e B ++ Sensores ok -> PCB - organizar melhor os componentes - posicionar melhor o arduino - aumentar o tamanho das trilhas - cortar a placa e fazer malha ## Grupo 4 ### GitLab ![](https://i.imgur.com/JpypadW.png) ### Simulação do TinkerCAD https://www.tinkercad.com/things/iHWf35zA78X-smashing-leelo-bigery/editel?sharecode=JmDoUISQP_iLKzUWTXZ7umdb5QYukawrltvhyrqV3fs ### PCB do Altium https://gitlab.com/MinervaBots/ps/processo-seletivo-2022-2/grupo-4/Projeto/eletronica/altium Esquematico: + boa organização de quadros - Nomes das netlabels pouco intuitivas + microcontrolador arduino ok + sensor ultrassonico ok - Ldr faltou faltou resistor pullup - faltaram enable ligado(5v), não colocaram sense ligado no ground ,VS e VSS (lógico e de potência) - regulador com capacitores errados PCB: + tem trilhas feitas na placa - trilhas finas pode dar problema + a PCB está em uma layer só - não tem malha de gound + puseram componentes relativamente próximos para fazer ligações da PCB ### Feedback Grupo 4 * - Não está no git * + Git organizado! * + Circuito bem feito * + Tirando cmDireito e cmEsquerdo variáveis intuitivas * + Bons comentários * + Identadinho * --- Usaram pulseIn ao invés de delay, isso PARA o código esperando o sinal voltar. (PÉSSIMO PRO ROBÔ!!!) * ----- Não usaram attachInterrupt!!!! * - Duas funções fazendo a mesma coisa, poderia ter passado os pinos por parâmetro * - Não usaram PWM no desafio * Funciona mas essa implementação é péssima pro robô como mencionado devido ao uso do PulseIn. Recorra as aulas para implementar da melhor forma. ## Grupo 5 ### GitLab ![](https://i.imgur.com/EkGOGQk.png) ### Simulação do TinkerCAD ### PCB do Altium esquemático: - Esquemático com pouca separação - Linhas de circuito atravessando a folha (pouca netlabel) Motores: - Foi recomendado utilizar header, utilizaram o driver (LN298) - Ligação errada dos motores entradas e nas saídas (in e outs errados) - sense deveria estar no ground - enables deveriam estar no 5v ou 3,3v Alimentação: + regulador ok + colocaram um switch para ligar e desligar robo Controle e sensores: + ligaram corretamente o sensor ultrassônico PCB: - Não tem trilhas na placa - As placas não estão cortadas + tentaram organizar os componentes próximos # **SEM TINKERCAD**

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully