Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

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.

CCS/MSP430F5529: Using an ESP8266 to send stored values stored in ADC12 to Thingspeak.com

Part Number: MSP430F5529

Tool/software: Code Composer Studio

Hello, I am trying to complete a project where the voltage from a voltage divider using a photoresistor is converted to a digital value through the MSP430's ADC12, and then that value is sent over UART to an ESP8266 which sends it to a plot at Thingspeak.com. I have figured out how to use ADC12 and send it through UART. However, I am lost as to how to implement the ESP8266. Through my research, I have found that this has been used very often with Arduinos, but I cannot find anything on how to flash the ESP8266 using the MSP430. I am confused as to whether I can just flash it with an Arduino to pull values from the RX / TX pins associated with MSP430, or whether it all needs to be handled by the MSP430. I have provided my code which sets up the MSP430's UART and ADC12 accordingly. Any help on how to interface this with the ESP8266 to send this information to Thingspeak.com would be greatly appreciated.

#include <msp430.h>
int main(void)
{
    WDTCTL = WDTPW + WDTHOLD; // Stop WDT

    P3SEL |= BIT3 + BIT4; // P3.3 & P3.4 = USCI_A0 TXD / RXD to ESP8266
    UCA0CTL1 |= UCSWRST; // Reset state machine
    UCA0CTL1 |= UCSSEL_2; // SMCLK
    UCA0BR0 = 109; // Baud Rate = 9600
    UCA0BR1 = 0; // USCI A0 Baud Rate 1
    UCA0MCTL |= UCBRS_2 + UCBRF_0; // Modulation UCBRSx=2, UCBRFx=0
    UCA0CTL1 &= ~UCSWRST; // Initialize USCI state machine

    P6SEL |= BIT2; // P6.2 Select
    REFCTL0 &= ~REFMSTR; // Hand over control of internal reference voltage to ADC12 control registers
    ADC12CTL0 = ADC12SHT02 | ADC12ON | ADC12REFON | ADC12REF2_5V; // ADC12 Sample Hold 0 Select Bit: 2, ADC12 On/enable, Reference Generator On, Reference Generator 2.5V
    ADC12CTL1 = ADC12SHP | ADC12SSEL1; // ADC12 Sample/Hold Pulse Mode, ADC12 Clock Source Select Bit: 1, Sequence 1
    ADC12MCTL0 |= ADC12INCH_2; // ADC12MTCL0 Channel A0 Select
    ADC12CTL0 |= ADC12ENC; // ADC12 Enable Conversion

    while(1)
    {
        ADC12CTL0 |= ADC12SC;
        while (ADC12CTL1 & ADC12BUSY);

        // Convert Value Stored In MEM0 & Add to UART TX
        int thousand = ((int)ADC12MEM0)/1000;
        int hundred =  ((int)ADC12MEM0)%1000/100;
        int ten =  ((int)ADC12MEM0)%1000%100/10;
        int one =  ((int)ADC12MEM0)%1000%100%10;
        while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
        UCA0TXBUF= thousand + 0x30;
        while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
        UCA0TXBUF= hundred + 0x30;
        while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
        UCA0TXBUF= ten + 0x30;
        while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
        UCA0TXBUF= one + 0x30;
        while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
        UCA0TXBUF= (0x0A);  //Enter
        while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
        UCA0TXBUF= (0x0D);  //Carriage return
    }
}

  • Hi,

    It seems that this is a requirement with ESP8266. I'm sorry that this is not a TI device, so we don't have the example code or user guide for you.

    Maybe you can contact ESP8266 vendor or get more information from the Internet.

    Thanks!

    Best Regards

    Johnson

**Attention** This is a public forum