Programmer USB to serial UART connections with EmonTx shield using Arduino IDE on Mac OSX

After taking onboard the advice

So I think you need to think why you need both, and work from there.

and the information about firmware file locations.

So basically the “src” directory you are compiling the sketch from is actually part of the sketches structure and not just a folder of the same name, any files you place in the src folder will be seen by the IDE and assumed to be part of the same sketch (if the file extension is valid).

I did some more researching and read carefully PlatformIO: Compile & upload firmware. Blog post 1/3, which was very informative. The penny dropped when I read this blog, specifically step 2 about cloning from GitHub

  1. Clone emonTx / emonPi repo
    We’ll use the emonTx (V3 discrete sampling) as an example here but the steps are exactly the same for emonPi.
    emonTx V3
    $ git clone https://github.com/openenergymonitor/emonTxFirmware`
    $ cd emonTxFirmware/tree/master/emonTxV3/RFM/emonTxV3.4/emonTxV3_4_DiscreteSampling
    emonPi
    $ git clone https://github.com/openenergymonitor/emonpi`
    $ cd emonpi/firmware

After following these instructions I was then able to use PlatfomIO on my Mac OSX to compile, upload, use terminal window and serial monitor. I used PlatformIO on Mac OSX the to up load firmware to EmonTx’s and EmonTh’s, changing node ID’s and saving config to EEPROM [emonTx / emonTH configure RF settings via serial (released FW: V2.6 / V3.2)] using instructions here emonTx / emonTH configure RF settings via serial (released FW: V2.6 / V3.2)

I was then ‘feeling brave’ and decided to have ago at the CLI PlatformIO on my EmonPi and this worked very well also to upload firmware etc., using the upload port /dev/ttyAMA0 stopping and starting emonhub. The only snags I had with this was firstly, the LCD on the EmonPi locked with the screen saying it was booting, which easily rectified with rebooting the EmonPi from local Emoncms; the second was, the very last PlatformIO CLI

  1. View serial port with PlatformIO CLI
    $ pio serialports monitor -b9600

I could not get this to work with baud-rates 9600 or 115200, what is the correct baud-rate or have I missed something out?.

I still have both Arduino IDE and PlatformIO IDE installed, PlatformIO (now) works for me nevertheless, I’m a relative newbie to this level of open source hardware and software (so had no prior experience of using IDE’s to compare it with); still climbing up this learning mountain just beginning to see ‘base camp’.

I’m just starting to get to grips with calibrating the voltage sensor and CT sensor outputs in EmonPi and EmonTx, which I’ll continue in the first topic I posted Ref voltages on emonpi and emontx calibration and more accuracy when I have some more data and made adjustments in the firmware.

Many thanks for all the help.