Reading SPI and send more than 12 bits

Hello friends. There is my issue, I have a sensor which has ADC 24 bits data through SPI, could I receive (SPI) and send (Wifi) these same 24 bits? (Since the ADC of the spark core is 12 bits).
By the way, I’m new working with the Spark core. Regards.

@afromero, if your sensor is SPI based then reading it will not be a problem.

Sending the data in the format of your choice will also work just fine and there are many ways to do that with Spark.variables(), Spark.publish(), TCPClient, UDP, etc. :smile:

1 Like


Here’s a quick guide for getting you up and running :smile:

  1. Search the internet for an Arduino or C/C++ library for your sensor model. If it exists you may be able to port it to the Spark Core very easily. Jump to Step 6.
  2. Get your sensor datasheet and review the commands required to access your ADC inputs.
  3. Review the SPI Documentation and determine what speed, mode and commands are needed for reading your ADC:
  4. Start with a sketch/application that just works on setting up the SPI and talking to your sensor, and printing values to the Serial or Serial1 port of your choice.
  5. Wrap up these commands in a C++ Class (aka Library) to make it easier to use.
  6. Now that you have a working Library for your sensor, add WiFi connectivity by using Spark.variables(), Spark.function() or Spark.publish()

Once you get to coding and debugging, let us know if you run into any roadblocks. I’m sure there’s bound to be a few things that pop up! :spark:

1 Like