This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

  • Resolved

PGA460-Q1: Interfaced to Arduino Uno_source code

Prodigy 190 points

Replies: 27

Views: 578

Part Number: PGA460-Q1

Hi,

    Could you please share me the arduino source code for interfacing the PGA460-Q1.I have designed and developed the ultrasonic sensor module using PGA460-Q1 driver IC and Murata sensor.I would like to inteface this sensor with arduino uno for getting the distance information.Please provide the suitable source code for this 

Thanks & regards

Sreejith S V

  • Hi Sreejith,

    For PGA460 software development, I recommend that you start with the PGA460 Software Development Guide and PGA460 Energia Library and Code Example downloads. These will help guide you with USART (UART and SPI) specific examples for the Energia and Arduino microcontroller kits.

    For information on the general structure of the USART packet, refer to section "7.3.6.2.1 USART Asynchronous Mode" of  the datasheet: http://www.ti.com/lit/ds/symlink/pga460-q1.pdf. Note the non-default 2-stop bit requirement for the UART configuration.

    Akeem Whitehead // Texas Instruments // ASC-SENSING-CSPS // Applications Engineer
    Visit our Ultrasonic Sensing FAQ page for additional information.
  • In reply to Akeem Whitehead:

    Thanks Akeem for your quick response.Will go through these documents and get back to you if any support is required for the same.

    Thanks & Regards

    Sreejith

  • In reply to Sreejith S V:

    I just gone through the document and tried to compile the code using arduino id,getting so many errors.I solved  most of the errors,but still there is some errors related to the library functions.Could you please share me the modified code which is suitable for arduino ide and arduino controller.My actual aim is to get the distance data from the sensor via one wire communication using arduino .Sensor board is ready with pga460 and murata sensor.

  • In reply to Akeem Whitehead:

    I just gone through the document and tried to compile the code using arduino id,getting so many errors.I solved  most of the errors,but still there is some errors related to the library functions.Could you please share me the modified code which is suitable for arduino ide and arduino controller.My actual aim is to get the distance data from the sensor via one wire communication using arduino .Sensor board is ready with pga460 and murata sensor.

  • In reply to Sreejith S V:

    Hi Sreejith,

    Does Arduino Uno support Serial1? The code uses two serial ports: one for serial communication to the PC, and the other for serial/UART communication to the PGA460.

    To get the PGA460 Energia library to run in Arduino Mega:

    1) Delete the following from the PGA460EnergiaLibrary_vx.x.x library folder: "PGA460_SPI.cpp", "PGA460_SPI.h", "utility" folder. The SPI functions for the PGA460 were customized specifically for the MSP430F5529 microcontroller. SPI support is only enabled through Energia, not Arduino at this time.

    2) Replace all instances of #include <Energia.h> to #include <Arduino.h> in the library files (PGA40_USSC.h/.cpp)

    3) In all files, change any reference of "PUSH2", "GREEN_LED", "RED_LED" to a Arduino pin numbers. These designators are specific to the Energia.h file for the LaunchPads.

    4) Delete case 3 from the initBoostXLPGA460 function in PGA460_USSC.cpp.

    Akeem Whitehead // Texas Instruments // ASC-SENSING-CSPS // Applications Engineer
    Visit our Ultrasonic Sensing FAQ page for additional information.
  • In reply to Akeem Whitehead:

    Hi Akeem,

                      Thanks for your reply.I already solved the issues by studying the code and modified for  Arduino IDE.Successfully compiled for Arduino Mega .My sensor PCB fabrication is in progress and after getting it assembled will test this code using arduino mega and sensor board.Will let you post the status.

    Can I interface multiple sensor using the same code and what will be the interface for multiple sensor interface?

    My assumption is by changing the address we can interface multiple sensors using one wire interface.For that I need to connect serial to onewire transceiver chip in between arduino serial and sensor board and connect all the sensor boards IO line to transceiver output?Is this correct,Please let me know

    Thanks

    Sreejith

  • In reply to Sreejith S V:

    Hi Sreejith,

    The PGA460 offers four different interfaces: UART, SPI, OWU, and TCI

    OWU and TCI are automotive interfaces referenced to high-level battery. In this case you would need a transceiver to level shift from VPWR (i.e. 12V) to 5V for a logic high.If your application is not automotive, I recommend that you use UART or SPI so you can directly interface the PGA460 to the Arduino without the need for a transceiver. UART/SPI is much easier to work with anyway.

    Because the PGA460 has a three-bit software address (UART_ADDR), you can have up to eight PGA460s on the same UART or SPI bus. Refer to PGA460 FAQ #4.4.11 (http://www.ti.com/lit/pdf/slaa733) for details on auto-addressing:

    4.4.11 Is daisy-chain supported by the PGA460? Can the master controller automatically differentiate and program the PGA460 UART address? Daisy-chain auto-addressing and automatic slave node position detection (SNPD) are not supported by the PGA460. External hardware or switches must be used in combination with the external master controller to automatically assign address to multiple PGA460 devices connected to the same bus. The example provided is interchangeable for the IO and TX pin. When switching IO, be sure select a bidirectional switch rated for VPWR (up to 30 V). The TX pin is a unidirectional pin rated at either 3.3V (default) or 5.0 V.

    Akeem Whitehead // Texas Instruments // ASC-SENSING-CSPS // Applications Engineer
    Visit our Ultrasonic Sensing FAQ page for additional information.
  • In reply to Akeem Whitehead:

    Hi Akeem,

                   My PGA460 with sensor board is now ready and started testing using arduino mega.I connected the TXD and RXD pins to RX0 and TX0 of arduino mega and supplied 12VDC power input.But the sensor is not responding.I have attached my schematic and arduino serial monitor screen shots.Please check and advice for troubleshooting the same

    Regards

    Sreejith

  • In reply to Sreejith S V:

    Hi Akeem,

                        I have solved the issues and getting the object distance data from the sensor.The following are the issues

    1)I am using 5V micro so need to connect 100k pull up to 5V

    2) UART Communication port required in Arduino is TX1 and RX1 

    3) Required to enable the temperature compensation register bit else remove the mosfet and connect ground  to transformer secondary pin 4

    Could you please suggest me  the actual configuration required for my hardware and the meaning of the red marked configurations .I am using  Murata MA58MF14-7N sensor

    1. Communication Mode: 0=UART, 1=TCI, 2=OneWireUART ... 0
    2. UART kBaud: 0=9.6, 1=19.2, 2=38.4, 3=57.6, 4=74.8, 5=115.2 ...0
    3. P1 and P2 Thresholds: 0=%25, 1=50%, or 2=75% of max ... ?
    4. Transducer Settings: 0=Murata MA58MF14-7N, 1=Murata MA40H1SR, x=Skip ... 0
    5. TVG Range: 0=32-64dB, 1=46-78dB, 2=52-84dB, or 3=58-90dB, x=Skip ...?
    6. Fixed TVG Level: 0=%25, 1=50%, or 2=75% of max, x=Skip ... ?
    7. Minimum Distance = 0.1m * BYTE ... ?
    8. Run System Diagnostics?: 0=No, 1=Yes ... 0
    9. Echo Data Dump: 0=None, 1=P1BL, 2=P2BL, 3=P1LO, 4=P2LO,... ?
    10. Burn User EEPROM?: 0=No, 1=Yes ... ?
    11. Command Cycle Delay: 10ms * BYTE ... ?
    12. Number of Objects to Detect (1-8) = BYTE ... 1
    13. UART Address of PGA460 (0-7) = BYTE ... 0

    Regards

    Sreejith

  • Part Number: PGA460

    Hi

      I am also getting the same ultrasonic readings with or without objects present.Switching on and off the power supply will sometimes give a different measurement number. Please provide the suitable solution for this.

    I am using arduino mega 2560 and Murata MA58MF14-7N transducer.

    Regards

    Sreejith

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.