Code Monkey home page Code Monkey logo

p1am's Introduction

ProductivityOpen P1AM Build Status

Product Description

The ProductivityOpen P1AM is an automation platform compatible with Productivity 1000 Series I/O modules, P1AM Series shields, and Arduino MKR format shields.

  • P1AM-100: The board uses the SAMD21G18 Microcontroller like the Arduino MKRZERO and other similar boards.
  • P1AM-200: The board uses the SAMD51P20 Microcontroller like the Adafruit Grand Central and other similar boards.

Hardware - P1000 I/O Modules

Productivity Series modules offer several types of industrial grade I/O

  • Analog and Temperature Inputs
  • Analog Outputs
  • Discrete Inputs
  • Discrete Outputs and Relays
  • Specialty Modules

Hardware - P1AM Shields

ProductivityOpen offers 3 types of industrial shields and a prototyping kit.

  • P1AM-ETH
  • P1AM-SERIAL
  • P1AM-GPIO
  • P1AM-PROTO

Base Controller

The P1AM Base Controller is the chip that directs communcations between the microcontroller and the P1000 Modules. A P1000 Series power supply or external 24V supply is required to power the Base Controller and modules.

The P1AM-100 communications with the SAMD21 are SPI based and use 5 total pins. Pins 8, 9 and 10 can be shared with other SPI devices. A3 and A4 must not be used on any shield if using the base controller functionality of the P1AM-100

Pin Function
8 MOSI
9 CLK
10 MISO
A3 CS
A4 ACK

The P1AM-200 Base Controller pins are all internal. No header pins are used for IO module communications.

In depth information on the P1AM family hardware can be found on the reference page here: ProductivityOpen Documentation

Hardware can be purchased on the Automation Direct Webstore

P1AM Library

Description

The P1AM Library provides a simple interface for controlling P1000 Modules.

P1.writeDiscrete(HIGH, 1, 2);  //Turn slot 1 channel 2 on

float temperature = P1.readTemperature(2, 3);  //Return temperature read from slot 2 channel 3

Installing the Library

Install the Arduino IDE version 2.0.0 or later. We recommend the current version on the Arduino website.

  • Use Arduino's Library Manager to install the library. Tools > Manage Libraries
  • Type P1AM into the search box and click the install button

Installing the Board

  • Start the Arduino IDE and select File > Preferences
  • Enter https://raw.githubusercontent.com/facts-engineering/facts-engineering.github.io/master/package_productivity-P1AM-boardmanagermodule_index.json into the Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.
  • Use Arduino's Boards Manager to install the board. Tools > Board > Boards Manager
  • Type P1AM into the search box and click the install button

Getting Started

Documentation can be found on the ProductivityOpen Documentation. The website has information that includes the hardware documentation, library API, and code snippets.

The P1AM library also comes packed with examples that can be found in the Arduino IDE under File > Examples > P1AM.

Additional Resources

ProductivityBlocks Graphical Programming from Automation Direct

Automation Direct P1AM Customer Forum

Automation Direct Webstore

Arduino Getting Started

Arduino Forum

Arduino Support Discord

p1am's People

Contributors

adamcummick avatar bbbowden avatar edhubbell avatar kumataru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

p1am's Issues

Error downloading additional board manager

I am trying to configure Arduino IDE for the P1AM. I put the URL as in this thread into the additional boards manager and get a download error. As well as when searching for board under manager there is no P1AM. If any one could help point me in the right direction that'd be great

writePWM Bug

Writing to PWM module using "void P1AM::writePWM(float duty,uint32_t freq,uint8_t slot,uint8_t channel)" function causes incorrect behaviour. Offsets were incorrectly counted and ignored the first A0 module bytes. Fix for bug appears to be in lines 562-567

for(int i=0;i<slot-1;i++){
		tempLoc = baseSlot[i].dbLoc;
		if(mdb[tempLoc].aoBytes > 0){
			offset += mdb[tempLoc].aoBytes;		//get offset of analog bytes
		}
	}

Configuration for Read Temperature

Hello folks,

I was having trouble configuring a P1-04THM module with a K-type thermocouple and unit of C. Using the "ReadTemperature" example, it didn't show where or how to input the configuration constant that the website generates.

The fix is to use P1.configureModule in the setup, which wasn't shown on the website. This is the modified example.

/*
Example: ReadTemperature

This example shows how to read temperature values in degrees from a temperature input module.
The readTemperature function is also used when a temperature module is using a voltage or
resistance range as it still returns a floating point value.

Temperature inputs are analog inputs that read data from a temperature sensor and convert it into a
temperature reading. These include thermistors, thermocouples and resistance temperature detectors (RTDs)

This example works with all P1000 Series:

  • Temperature input modules such as P1-04NTC, P1-04RTD, and P1-04THM.

The default ranges are:

  • P1-04THM: J-Type
  • P1-04RTD: Pt100
  • P1-04NTC: 2252

This example will print channel 2's temperature to the serial monitor every second.
This can be tested by:

  • Using an appropriate temperature probe for the module
  • Shorting the positive and negative inputs of a THM module to read room temperature.
  • Using a potentiometer to simulate thermistor/RTD signal on an NTC or RTD
    module and using a temp. vs. resistance chart to verify values.

The reported temperature defaults to degrees Fahrenheit.
_____ _____
| P || S |
| 1 || L |
| A || O |
| M || T |
| - || |
| 1 || 0 |
| 0 || 1 |
| 0 || |
¯¯¯¯¯ ¯¯¯¯¯
Written by FACTS Engineering
Copyright (c) 2019 FACTS Engineering, LLC
Licensed under the MIT license.
*/

#include <P1AM.h>

//this is the configured data from the website
const char _PBVAR_1_ConfigureP104THM_4[] = {
0x40, 0x03,
0x60, 0x01,
0x21, 0x01,
0x22, 0x01,
0x23, 0x01,
0x24, 0x01,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
0x00, 0x00
};

float temperature1; //Variable for the temperature being read. "float" variables can store decimal values like 1.23
float temperature2; //Variable for the temperature being read. "float" variables can store decimal values like 1.23
float temperature3; //Variable for the temperature being read. "float" variables can store decimal values like 1.23

void setup(){ // the setup routine runs once:

Serial.begin(115200); //initialize serial communication at 115200 bits per second
while (!P1.init()){
; //Wait for Modules to Sign on
}
P1.configureModule(_PBVAR_1_ConfigureP104THM_4, 4); // configures module on slot 4

}

void loop(){ // the loop routine runs over and over again forever:

temperature1 = P1.readTemperature(4, 1); //Look at input module in slot 4, Return temperature read from channel 1
temperature2 = P1.readTemperature(4, 2); //Look at input module in slot 4, Return temperature read from channel 2
temperature3 = P1.readTemperature(4, 3); //Look at input module in slot 4, Return temperature read from channel 3

Serial.print("Channel 1 Temperature: ");
Serial.println(temperature1, 2); //print the value in degrees Fahrenheit up to 2 decimal places
Serial.print("Channel 2 Temperature: ");
Serial.println(temperature2, 2); //print the value in degrees Fahrenheit up to 2 decimal places
Serial.print("Channel 3 Temperature: ");
Serial.println(temperature3, 2); //print the value in degrees Fahrenheit up to 2 decimal places

delay(1000); //wait 1 second

}

low PWM adjustment resolution

pwm duty cycle only matches the integer part of float duty input argument in writePWM and writePWMDuty functions. The
dutyInt = (uint32_t)duty * 100; on lines 629 and 580 need to change to dutyInt = (uint32_t)(duty * 100);

Add PlatformIO Board Support

Problem

The P1AM-100 is not directly supported as a board in PlatformIO. It appears that the board library and other dependencies are made available, but P1AM-100 is not listed as a supported board.

  • Note: There are currently three (3) issues open on the PlatformIO GitHub project regarding this request as well. One such is platformio/platform-atmelsam#173.

Proposed Solution

The P1AM-100 board is added to PlatformIO as a supported board to allow simpler and more user-friendly interaction with the P1AM-100 system for advanced use cases.

Additional Information

It would be great to see direct support added for the P1AM-100 board on PlatformIO. While the main/recommended IDE is still Arduino IDE, and should remain so for most customers and use cases, supporting the possibility of more advanced use cases would be very valuable.

It seems like either way, supporting the P1AM-100 in PlatformIO would fall under NRE (non-recurring engineering). As such, implementing this PlatformIO P1AM-100 support would likely be a one-time development effort, and subsequent updates would require minimal to no effort to mirror on PlatformIO as well (seems like most things already are anyways).

Meta

Thank you for your consideration.

I hope to see support (or movement towards support) for PlatformIO added in the immediate or near future. This has been requested since 2021 and is being discussed again more recently this year as well. I'm not sure if there is a hold-up, or other bottleneck at this point, but it seems like this has been, and is being discussed on both sides again this year.

Reference

Read Value From Output Module (Question)

I have been tinkering with the P1AM-100, and I am having an issue reading the current value from an output module. Looking through the documentation I believe it only supports writeDiscrete(). I was wondering if there is any way to read the status of an output, so I don't have to keep track of the status in a global variable. The output module I am using is a P1-15TD2.

platformio support?

Hi! First of all thanks for this awesome project!

I was wondering if you'd be open to adding platformio support?
For the library it's nothing more than registering it. I guess I could do it myself, but since it's your project I figured it would be better to ask first.

For the board itself it seems like adding a JSON config for the board would be enough. I don't know how different the P1AM is from a regular Arduino MKR Zero, so maybe that would just work?

P.S. I have some questions/suggestions about the hardware as well. What would be the best place to share them?

Power P1AM with Battery

Do you have any suggestions on how to configure the PLC to switch to battery power in the case of a power outage?

HSC readPosition returns an int instead of an unsigned int. Doesn't match function header

P1AM/src/P1_HSC.cpp

Lines 173 to 187 in b1a57aa

/*******************************************************************************
Description: Reads the current positon of the channel in counts. Value is a
32 bit unsigned interger and will roll under/over at 0xFFFFFFFF
Parameters: -none
Returns: -int current position in counts
Example Code:
*******************************************************************************/
int P1_HSC_Channel::readPosition(void){
return (int)P1.readAnalog(slotNumber,channelNumber);
}

This function returns an int when the function header says it will return an unsigned int. I'm not sure if the rollover will work properly this way. Can you please advise?

Error in downloading

I am trying to download the board manager but every time I type or copy the URL to the board manager it comes up with an error code. I was running it on 1.8.15, where no other board managers would load, but downloaded the legacy version of 1.8.7 where it still came up with an error message even though other ones loaded. I have followed the instructions on the other page as closely as possible and have attempted this on multiple computers, all coming up with the same error. Any advice on how to fix this issue?

P1-04THM configuration issue

I am attempting to read a load cell using the P1-04THM module configured for 0-39 mV. When using the appropriate configuration array the resulting reading is consistently zero. If I configure the channel as a thermocouple I see the reading change as force is applied to the load cell. This indicates the sensor is connected and powered correctly but the THM module is behaving different with the 0-39 mV configuration.

Pulse Counter Capabilities

Hi,

I'm interested in using your device to take my prototype pulse counter into production, I have a few questions:

  1. Can it support int64?

Arduino's allow for uint64_t which will behave like an int64

  1. How can I connect this information of the PLC to a computer?

I'd like to make a virtual serial connection and continuously send data to a program on the computer, is this feasible with your device?

Thank you!

Question about HMI interfacing with P1AM

Hello there!
I'm looking at the P1AM device for some industrial control solutions, but I was wondering about connecting this to an HMI.
Are there any specific or maybe suggested ways to create an HMI for the P1AM product?

Have you done anything in regards to setting up an HMI for this product?

Regards,
Agustin Guzman

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.