1 2 3 Previous Next 37 Replies Latest reply on Apr 2, 2014 6:20 AM by content.librarian

    Sanor sensors readings.

    sabino.nunez.lopez

      Hello Everyone, I need some tips for my project..

         

       

         

      I am trying to read data from 4 sonar sensors, after that, i want to take the max value of all of them and average them.

         

      Thanks.

        • 1. Re: Sanor sensors readings.
          user_14586677

          Some questions -

             

           

             

          1) Do you know how a sonar sensor works ?

             

          2) How to measure time with PSOC ?

             

          3) Are you new to PSOC and its design tool Creator ?

             

          4) Is the sonar sensor signal conditioned or a "raw" sensor ? By this

             

          I mean does it put out pulse width or voltage or current proportional to distance,

             

          or just a small signal when it receives sound pressure ?

             

          5) Part number of sonar sensor.

             

          6) Are you working with a Cypress development board, if so which one ?

             

          7) Goals of design, distance range you want, resolution in meters or feet, accuracy......

             

          8) Medium sensor is transmitting in, air, water, fluid.......

             

           

             

          This will give forum some idea of how to help you.

             

           

             

           

             

          Regards, Dana.

          • 2. Re: Sanor sensors readings.
            sabino.nunez.lopez

            1) Do you know how a sonar sensor works ?

               

            Yes. it send a pulse and when it hits something it bounce back..

               

             

               

            2) How to measure time with PSOC ?

               

            I do not know, sorry.

               

             

               

            3) Are you new to PSOC and its design tool Creator ?

               

            yes, i am new to PSOC..

               

             

               

            4) Is the sonar sensor signal conditioned or a "raw" sensor ? By this

               

            I mean does it put out pulse width or voltage or current proportional to distance,

               

            or just a small signal when it receives sound pressure ?

               

            it put out a voltage proportional to distance.

               

             

               

            5) Part number of sonar sensor.

               

            this is the website for the sonar sensor.. ( http://www.robotshop.com/en/maxbotix-ez1-ultrasonic-ranger.html?utm_source=google&utm_medium=base&utm_campaign=GoogleUSA# )

               

             

               

            6) Are you working with a Cypress development board, if so which one ?

               

            we are using PSOC5 LP and also we are using PSOC creator 2.1

               

             

               

            7) Goals of design, distance range you want, resolution in meters or feet, accuracy......

               

            There are going to be 2 robots. the sonar sensors will prevent the second robot to hit the first one and to avoid going too far. If it goes too far, the robot will speed up. if it goes too close, the motor will slow down.  it should keep a distance of 5 feet.

               

            It will keep sampling every 400ms. after that, we want to take the max value of each one and average them.. the value will be plug into a equation. the result will be compare with a table to make sure the robot is withing the safe distance.

               

             

               

            8) Medium sensor is transmitting in, air, water, fluid.......

               

            it is in Air

               

             

               

            I will attached a picture to show you what we have so far.. any tips or example that can help us??

            • 3. Re: Sanor sensors readings.
              sabino.nunez.lopez

              This is a new picture of what we think it is the final result...

              • 5. Re: Sanor sensors readings.
                user_14586677

                Thanks for answering.

                   

                 

                   

                First i recommend you download and install Creator 3.0, its free,and fixes bugs

                   

                in previous versions.                  http://www.cypress.com/psoccreator/

                   

                 

                   

                The basic approach you would use is convert the voltage to a digital value, then

                   

                apply your software tests to calculated distance.

                   

                 

                   

                The sensors are measured one at a time, via SW control of the mux. You can either

                   

                poll the A/D or you can set up an interrupt when it finishes a conversion. When you change

                   

                mux channel you need to delay to allow mux voltage to settle to the next sensor, that delay

                   

                is shown in datasheet. Then I would throw one A/D sample away (ignore it) and use the

                   

                next sample for data to use in calculations.

                   

                 

                   

                There are videos that train you on use of Creator here -    

                   

                          http://video.cypress.com/video-library/video/PSoC-Software

                   

                 

                   

                Concentrate on 2012 videos, early part of 2013.

                   

                 

                   

                Regards, Dana.

                   

                 

                   

                • 6. Re: Sanor sensors readings.
                  kyle.kinsey

                   Good day everybody,

                     

                   

                     

                  I am in the same project group as the previous poster (Zeri).  I will see if I can expand upon what has already been stated;

                     

                   

                     

                  1) We have 4 sonar sensors that return various voltage signals, with the maximum voltage output being the closest to the manufacturer's rating of voltage per foot.  So, for example, we may be 2 feet away, but we are getting voltage value jumps from 1mv to 200 mv (randomly).  The correct output is near 200 mv.   So my thought was this:

                     

                  Freezing analog inputs and storing the maximum value for the half second and then outputting would work well (In theory). Do correct me if I am wrong.  

                     

                   

                     

                  First, we poll the sensors for half a second, and pick the maximum value from that half second and use that in our distance formula.

                     

                   

                     

                  Next, that value from the previous step will be passed on to, presumably, the PWM to adjust the motor's speed if and when necessary.  I think this may also be an interrupt, but I am not too sure on how to set up interrupts on the PSoC 5LP.

                     

                   

                     

                  We are using DC motors, with sabertooth motor controllers:

                     

                  http://www.lynxmotion.com/c-10-motor-controllers.aspx

                     

                  The top one is our model in our robot.

                     

                  Our motor model is:

                     

                  http://www.lynxmotion.com/p-653-gear-head-motor-12vdc-301-200rpm-6mm-shaft.aspx

                     

                  I have been looking for instructions on controlling geared DC motors with psoc but found none.  Only the stepper motor models.

                     

                  Thank you for any help you provide on getting these up and running.  

                     

                   

                     

                  I saw your MUX -> ADC converter diagram.  One problem I see with that, again, from an untrained PSoC user, is that there will be a lot of inputs during our sampling rate, and the 4 input MUX would not be able to handle it (again, from an untrained user).  Am I missing something from the diagram?  Thank you for any help you can provide

                  • 7. Re: Sanor sensors readings.
                    user_14586677

                    Freezing analog inputs and storing the maximum value for the half second and then outputting would

                       

                    work well (In theory). Do correct me if I am wrong.  

                       

                     First, we poll the sensors for half a second, and pick the maximum value from that half second and use

                       

                    that in our distance formula.

                       

                     

                       

                    1) What causes the noise level, other objects moving in the field of the sensor ? You could approach it just the

                       

                    way you are now, you could average out the noise, or do a peak detection scheme either in analog or just

                       

                    testing a stream of samples. Or use DFB block and filter.

                       

                     

                       

                        

                       

                     

                       

                              

                       

                    Next, that value from the previous step will be passed on to, presumably, the PWM to adjust the motor's

                       

                    speed if and when necessary.  I think this may also be an interrupt, but I am not too sure on how to set up

                       

                    interrupts on the PSoC 5LP.

                       

                     

                       

                    2) Interrupts, attach an ISR component to the HW source of interrupt. Name it. Tool then creates a .c and .h

                       

                    placeholder files to put your code and definitions in. Global interrupt must be enabled. I do not think you

                       

                    need an isr to feed the pwm, just take your decision output of sensors and write to PWM to update it.

                       

                     

                       

                        

                       

                     

                       

                               I saw your MUX -> ADC converter diagram.  One problem I see with that, again, from an

                       

                    untrained PSoC user, is that there will be a lot of inputs during our sampling rate, and the 4

                       

                    input MUX would not be able to handle it (again, from an untrained user).  Am I missing

                       

                    something from the diagram? 

                       

                     

                       

                    3) The A/D primarily sets sample rate. The settling time of the mux is the following, so I am

                       

                    not sure I understand your question -

                       

                     

                       

                     

                    • 8. Re: Sanor sensors readings.
                      ki.leung

                       According to the spec. There are 232 output and PW output. It may be easier to use those outputs. using interrupt would solve your problem, no need to sample the analog value.

                      • 9. Re: Sanor sensors readings.
                        ki.leung

                        You mentioned there are 4 sensors, were they pointing to the same direction? Are they being controled or free running? Are there consideration for the echo from an object from the transimmision of another sensor causing incorrect readings?

                        • 10. Re: Sanor sensors readings.
                          ki.leung

                           according to the specfication of the motor controller, you can use ananlog value or use serial signal to control. the only issues is you need to use servo control (PID) algorithm to adjust the speed of the motor.

                          • 11. Re: Sanor sensors readings.
                            user_14586677

                            Or use an unconditioned sensor, one w/o the PIC and analog on the module,

                               

                            and save a lot of cost ? Use PSOC for all the conditioning + the heavy lifting,

                               

                            product functionality.....Just a thought as the sensor shows a cost of ~ $25.

                               

                            Why have two processors when one PSOC will do ?

                               

                             

                               

                            Notice PIC on Sonar module does not have internal reference, uses Vdd for

                               

                            reference, and unless Vdd is itself a ref accuracy/repeatability part to part is

                               

                            .......?

                               

                             

                               

                            Regards, Dana.

                            • 12. Re: Sanor sensors readings.
                              user_14586677

                              Actually on reflection it would be 1 PSOC vs 1 PSOC + 4 pic based sensors

                                 

                              at $ 25 each. Ech.

                                 

                               

                                 

                              Regards, Dana.

                              • 13. Re: Sanor sensors readings.
                                user_14586677

                                The of course one can look at replacing the $ 50 - $ 75 motor controller

                                   

                                with the PSOC + a motor driver ( ~ $ 5 or less ) chip to handle motor currents.

                                   

                                 

                                   

                                PSOC, conquering the world one UDB at a time.....

                                   

                                 

                                   

                                Regards, Dana.

                                • 14. Re: Sanor sensors readings.
                                  ki.leung

                                   Replacing the sensors and the motor control with a PSoC is possible but would increase the complexity of the project. I think the sensor part would be best to use the off the shelf one, but including the motor control would not be too hard as you would need to do the servo control part anyway. 

                                  1 2 3 Previous Next