Control Pi-Plate with Spark Core

The ppDAQC board from Pi-Plates.com is an inexpensive yet powerful solution for expanding the input/output capabilities of the Spark Core. And since Pi-Plates are stackable, it is a simple task to scale up the I/O capabilities of a single Core. All that is required for connectivity are the four SPI signals (signals A2-A5) as well as a single digital output (D6). Power can come from the Core or from the ppDAQC board.

Step 1: Required Components

To build this assembly the following components are required:

1. A ppDAQC board from Pi-Plates.com

2. A Spark Core

3. A 5VDC power supply or the USB power supply included with the Core.

4. A small protoboard (currently included with the Core Evaluation kit)

5. Jumper wiresControl Pi-Plate with Spark Core

Step 2: Connections – 1

The diagram and table explain how the ppDAQC and the Spark Core board are connected. This implementation uses an external 5VDC supply that provides power for the Spark Core through the ppDAQC board. This approach allows you to drive peripherals with the open collector pins that would pull more than 1 amp. If you’re just playing around, use the USB power supply that came with your Spark Core.

Step 3: Code: Structure

All Spark applications for the ppDAQC require three files:

1. ppDAQC.ccp – a lightweight set of library functions

2. ppDAQC.h – the header file with all of the function prototypes

3. yourapplication.ino – your application program

The application program has to have the following structure:

Step 4: Code Reference

As mentioned earlier, the function library for the ppDAQC board is lightweight. However, there are enough calls to access all of the major features. For more information about all of the features of the ppDAQC board, visit www.pi-plates.com. Common to all functions is an address argument with most functions requiring at least one parameter.

  1. void setDOUTall(byte addr, byte value) – write to all 7 open collector channels. The address value (addr) can range from 0 to 7. The value can range from 0 to 127.
  2. void setDOUTbit(byte addr, byte bit) – set a single open collector bit. The address value (addr) can range from 0 to 7. The bit can range from 0 to 6.
  3. void clrDOUTbit(byte addr, byte bit) – clear a single open collector bit. The address value (addr) can range from 0 to 7. The bit can range from 0 to 6.
  4. void toggleDOUTbit(byte addr, byte bit) – toggle a single open collector bit. The address value (addr) can range from 0 to 7. The bit can range from 0 to 6.Control Pi-Plate with Spark Core sematch
  5. int getADC(byte addr, byte channel) – perform a 10-bit A/D conversion. The address value (addr) can range from 0 to 7. The channel can range from 0 to 8. Note that the A/D range is 0 to 4.097 volts and that channel 8 is the power supply voltage.
  6. byte getDINall(byte address) – returns an 8-bit number showing the current signal status on the Digital Input block. The address value (addr) can range from 0 to 7.
  7. byte getDINbit(byte addr, byte bit) – returns the value of a single input bit (0 or 1). The address value (addr) can range from 0 to 7. The bit can range from 0 to 7.

Step 5: Wrap Up

The Spark Core is a small yet powerful microcontroller that has the potential of becoming the go-to device in the IoT arena. Merging it with a ppDAQC board from Pi-Plates.com using the steps above makes it an even more versatile tool.

 

For more detail: Control Pi-Plate with Spark Core


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top