Tutorial : Adding ADC capability to S5D9 IOT board

I have a S5D9 IOT board.  It is very compact.   I want to share my tutorial with the community on how to add ADC capability to the board.   I think that it is very useful if the sensor only has an analog output.

 

In this tutorial, I show 4 examples that covers both r_iic and r_sci_i2c drivers with and without framework.     Here is my blog link with source code available.

https://www.miketechuniverse.com/single-post/2018/03/02/Add-ADC-to-S5D9-IOT-board

 

There are other blogs from me such as adding a distance sensor, a temperature sensor, and a small OLED display that may be useful for your next small project.  Feel free to explore them.

 

Enjoy,

Michael

  • Michael, thanks for the great tutorial. When you were working with ADC and DAC, did you have access to an oscilloscope?

    I'm looking at buying a super cheap hobbyist DIY kit to at least check the signal.  Have you seen the DSO138 kits?

     

    You can get these official kits on Amazon.com for  $24.99.

     

     

    Searching on eBay results in even cheaper clones for $14.98

     

    Here's one example, shipping from the US for $20, free shipping, with the SMD components soldered on.

     

     

    Here's the specs on it.

     

    Maximum real-time sampling rate : 1Msps
    Accuracy : 12Bit
    Sampling buffer depth : 1024 bytes
    Analog bandwidth : 0 - 200KHz
    Vertical Sensitivity : 10mV / Div - 5V / Div ( 1-2-5 progressive manner )
    Adjustable vertical displacement , and with instructions
    Input impedance : 1MΩ
    Maximum input voltage : 50Vpp (1: 1 probe ), 400Vpp (10: 1 probe )
    Coupling modes include DC / AC / GND
    The horizontal time base range : 10μs / Div - 50s / Div ( 1-2-5 progressive manner )
    With automatic, regular and one-shot mode , easy to capture the moment waveform
    Available rising or falling edge trigger
    Adjustable trigger level position , and with instructions
    Observable trigger waveform before ( negative delay )
    Can freeze at any time waveform display (HOLD function )
    Comes 1Hz /3.3V square wave test signal source

     

    Any opinion on this?

  • In reply to codetricity:

    Look like a great find. An inexpensive kit like this one is great if it works. It is handheld. You can take it anywhere. It seems to be a good one to start. TFT is nice. I like it too!!! It is also available on Amazon.

    I have Digilent Analog Discovery for a few reason for a few years. When your needs grow, this one may be your next scope.

    Digilent Analog Discovery 2 ($279)
    store.digilentinc.com/.../

    1. I can use my large PC monitor (24") to see the details of the and all the digital signals (up to 16 I/O's at a time.)
    2. I can copy the scope waveform into my documentation or emails to others.
    3. Triggers are more advanced than just a signal. It can be protocol and command tiggered.
    4. It has I2C/UART/SPI protocol recognition capability. You can save energy and time from decoding the command/data.
    5. You can create any bus from the 16 digital inputs and display the value in dec/hex/binary format.
    6. It is portable and small. But, it requires that you have a laptop with you.

    I want to mention this one because you can compare it to the inexpensive DSO unit.

    Best regards,
    Michael
  • In reply to codetricity:

    We can also build a custom DSO with any Synergy MCU. S5 has 6+ ADC inputs and many digital inputs. Put these signals on a larger 8" TFT display. We got interrupts to select the target signals.

    I think that such DIY project with synergy MCU (TB S5D5) is possible. Probably not as fast as the FPGA based design used in Digilent Analog Discovery 2. Yet, the functionality will be very good.
  • In reply to Mike:

    Michael, thanks for this great information. I noticed that Eric's blog had a screenshot of the Digilent WaveForms software for their o-scopes. He included it in his article on DAC. I went on the Digilent site and saw that the WaveForms software worked with the Digilent Electronics Explorer and the Analog Discovery. I think Eric may have the same Analog Discovery unit that you have.  It looks like an excellent piece of equipment. I may get that after I progress. The Analog Discovery looks more portable than the Electronics Explorer and should take up less desk space.

     

     

  • In reply to Mike:

    That's a cool idea and I was just thinking about that. Do you already have a signal generator? maybe you built one? I think we'll need a signal generator to test the custom DSO with the Synergy MCU. You could use one S5D9 to build the signal generator and then confirm it with the commercial Digilent Analog Discovery unit that you have, then use the signal generator to test the custom S5D9-based DSO that you build.
  • In reply to Mike:

    Michael,

    Slightly different topic, though related. Do you ever have any issues with noise and USB cables? I am always sort of surprised when USB cables end up having different quality levels. Have you ever used Ferrite Beads? I am just now investigating snap-on/clamp-on ferrite beads which might be quite cost-effective.

    Jesse
  • In reply to codetricity:

    Here is a better deal with accessories. $299.

    store.digilentinc.com/.../

    Yes, I believe that Eric is using Analog Discovery. The device is the size of a tea cup plate. It is small and compact enough.
  • In reply to codetricity:

    It can be done since S5 MCU has both DAC (signal generator) and ADC (analog capture input). The current S5D9 IOT board does not give you access to any of the DAC and ADC pins. So, I would need the S5D5_TB board which I have at home. It is an interesting idea for a future project.
  • In reply to Jesse Casman:

    I don't know if that helps on USB cable noise. I have used small Ferrite Beads on the output of the voltage regulator and audio amplifier primarily for the inductor (?) noise. I had a mixed result. If a less quality cable had other issues with cross talk, then the problem would surpass what Ferrite Beads can do. Without knowing the nature of the noise is, it is hard to know if it helps.

    Regards,
    Michael
  • In reply to Mike:

    We just need access to the Analog pins, right?

  • In reply to codetricity:

    That is correct. My ADC example uses the analog input that connects to the onboard microphone. S5D5_BT and S7G2_SK boards have all the pins (ADC and DAC) available. S7G2_SK has Arduino-style header. Even S7A3 board has two ADC input pins available through one of the Grove headers.
  • In reply to Mike:

    I've researched more options in the last week. The goal is to find the cheapest equipment that can be used to help with tutorials.

    Logic Analyzer

    I've ordered a USB Logic Analyzer, which can be purchased for between $9 to $16. Here's a link to Amazon for a $16 unit.

    The hardware can be used with Sigrok PulseView

    Oscilloscope

    I've researched the cheapest possible oscilloscope units for learning.

    Unit Lowest Cost Found Usage or Notes
    DSO 138 $20 to $30

    Max 200 kHz, single channel.

    Standalone, not a USB DSO.

    Usable for PWM tutorials for servo (50 Hz) and variable speed DC motors

    Usable for audio signals (20 kHz), possibly using microphone

    Might be useful for watchdog timer tutorial

    Hantek 6022BE  $68 with shipping from China

    Max 48MHz sampling with 20MHz analog bandwidth (claimed), two channels. USB DSO. Community seems somewhat unhappy with software from vendor. possible open source solutions exist.

    Can be integrated with open source project Sigrok PulseView. Can replace firmware on boot temporarily with open source version. 

    Can be used with $5 Android App HScope.

    Another open source project called OpenHantek is available.

    Another older open source project called BasicScope may also work

    Owon VDS1022i $109 on Amazon Prime 25 MHz, 100MS/s, 5K record length, 2 channel, USB isolation
    Digilent Analog 2 Pro Bundle $300 Most people seem happy with it
    Bench Scope - Rigol DS1052E $260 Popular entry level bench scope, 50MHz, 2 channel
    Rigol DS 1054Z $349 50 MHz bandwidth, 4 channel. Serial decoding and trigger option is incremental $183 for SA-DS1000Z

     

    Two things about the Rigol DS 1054z

    1. There's a promo on until March 31, 2018 that provides the serial decoder and other software with the DS1054z. 

    2. The popular EEVblog is really keen on the DS 1054z

    Based on my current research, I think a good progression for the equipment shown in future tutorials is:

    Phase 1: Renesas board and software only, no outside components.

    Phase 2: Renesas board and free software with basic components and a multimeter. Assume that person has breadboard, wires, resistors, LEDs. 

    Phase 3: Show use of cheap $10 logic analyzer with short video or tutorial included with project that explains what the main learning concept such as i2c, SPI, UART does.  Tutorial shows open source Sigrok Pulseview as interface

    Phase 4: Show use of cheap $20 oscilloscope with project tutorial to illustrate main learning concept such as PWM for servo or variable speed motor control, audio, ADC. Limit max frequency to under 100 kHz

    Phase 5: Show use of normal entry bench oscilloscope such as Rigol DS 1054z

    Here's the EEVblog video review of the Rigol DS 1054z.