My students often blame the photon when their software does not work, which is silly since there are so many other things that might be wrong, however after teaching 3 semesters using the Photon it is possible that the occasional photon pin might be messed up. Has anyone made a photon test PCB and if so would you share the Eagle schematics? I assume particle.io has something for testing Photons.
I am thinking about making a testing board. The digital and analog input and output pins would be easy to test with photoresistors and LED's but how could I test uART, SPI and I2C pins without actually connecting expensive other boards. Are there test chips for each form of serial communication?
here is a link to a cheap I2C chip
Just remembered I have 10 of these that I can use.
that connects to the photon using all three types of serial connections (uART, SPI, I2C). I am fine getting a chip for each type but one chip that does all three would be a really good challenge.
How about designing a simple test jig that connects two photons together?
You have your “teacher” photon which is a known working unit.
If you test communications back and forth between that and a “student” photon, then you can be confident that the “student” photon is working.
Separately, you would most likely still want to test the remaining digital and analogue pins along with power pins to ensure no damaged pins.
I think that would give you fairly high confidence in the photon, would it not?
Absolutely a great idea. Don't need to buy any chips etc I like it, but not really sure how to do the teacher - student (master-slave) protocols with uART, SPI and I2C but I like the concept
@rocksetta, making a jig with a known-good Photon and a target Photon makes sense. For UART testing, a simple loopback (TX connected to RX) is all that’s needed on the tested Photon. Otherwise, a simple echo test between the testing and the tested Photon is good as well.
The Photon now supports both SPI and I2C slave modes so the master would be the testing Photon and the slave the tested Photon. Modes can be reversed as long as hookup is done correctly. GPIO is straight forward as is ADC. The testing Photon could put out a voltage on its DAC that is used as inputs to the tested Photon ADCs. PWM output could tested with pulseIn() on the testing photon.
The testing board may need analog/digital multiplexers (CD4067) to configure different pin arrangements. It would be interesting to hear from the Particle folks on their test jig experience. @rickkas7 or @KyleG, can you help with that?
So I have started to design my Photon Testing PCB board. Actually presently working on the code to flash to the Photon in question. I really want to be able to test a photon that has cloud connectivity but perhaps a dead pin.
Question: What is the most likely pin to die? Anyone at Particle know what is the most common dead pin (probably caused by user error). Not sure who works in customer support but they should have an idea of this issue.
Would you expect Digital pins, Analog (non 5V tolerant pins…), PWM or Serial. What would people expect to burn out most without totally destroying the Photon? Possibly this is one of those things that no one person has enough information to answer.
I guess I will just have to test all pins for every ability
I am testing all the GPIO pins, by setting the next higher pin to an output and then reading for both HIGH and LOW on the present pin.
Bit strange connecting every single GPIO pin together, but it seems to work. Even spotted the error in my logic with D7. The original code connected it to D8!
I really like the new revision share particle system for when I have a problem and need help, but this program is changing very quickly I think the only way to working with it is from a github site.
Sharing a revision is probably a great way to store a working backup that people can look at.
So I have PWM and AnalogRead Photon testing working on A5-A1 and A4-A0. Still makes me nervous connecting all these pins together by setting them to INPUT when not using them, but it seems to work.
The basic concept here is to use PWM to turn on an LED to 3 levels, then use- AnalogRead to read the levels from a photoresistor and a bit of fuzzy logic to check if the values are good. I needed to use my own photoresistor (inside a cylinder to block stray light) since the ones that came with the Photon were not sensitive enough.
@rocksetta, you could simply connect an analog (PWM) output to a digital input and use pulseIn() to measure the pulse width for different analog output values. Or use interrupts to measure the ON/OFF times. This is more accurate and simpler than your proposed approach IMO.
My way made a lot of sense until I saw how finicky the results were. Your way makes much more sense now. Thanks
Interesting: pulseIn() returns a number that is almost always 7.84 times the PWM value. Making it very easy to work with. Note: Both PWM 0 and PWM 255 return zero from PulseIn()
I have expanded my DAC test to test all the analog pins. My code for both DAC1 and DAC2 works great to test all of the other analog pins (So I use DAC1 to test A3 and DAC2 to test A6). But strangely I can’t run both tests one after the other, as if once DAC1 is activated it messes up DAC2 somehow.
I know that at analogWrite(DAC1, 0); still generates about 50 mV. So I am using pinMode(pin, INPUT) to reset my pins but I am not really sure if it works on the DAC’s. I also need to have all GPIO pins interconnected (Yes I find that troubling ).
The DOCS for DAC and analogRead get a bit confusing about AN_INPUT and INPUT
digitalWrite(DAC1, LOW); // set DAC pin low NEEDED!
pinMode(DAC, INPUT); // de-activate the DAC pin
Looks like the code is good to go:
Connect all GPIO pins together, flash and run
Use at your own risk!
I have changed my plans slightly. I will use a differernt PCB / breadboard setup to test the serial connections. Presently have uART working just need to get I2C and SPI going.
So working on breadboards now: Happens to coincide with my students making a few mistakes in class and frying a few Photons. The Photon-alone.ino and breadboard is currently working. I am still testing all the serial breadboards which eventually will be rolled into one (have I2C and uART working, still confused with SPI, the code not the breadboard).
Here is the github again:
Photon-alone testing Breadboard
…
uART Serial (GND, RX to TX and TX to RX)
…
I2C Serial (3V3, GND, D0, D1 both with 4.7 K ohm pullup resistors to 3V3 )
For your setups with a second Photon I can’t see how you power the second device? You have GND connected, but you might also want Vin or 3v3 connected.
For I2C you want 4k7 pull-ups not 470Ohm.
while(1) is usually used to trap your code in an eternal loop in case of an error condition.
But in this case it’s meant as a very tight loop to avoid any overhead introducted between loop() - but this will only work with non-AUTOMATIC SYSTEM_MODE()