![]() I think the problem is likely in your design of the capacitor resistor circuit. But it is a bit too long, so I only skimmed it quickly. ![]() I am impressed by the very detailed description of your problem. I know about rectifying, capacitor and resistor circuits, so I may try to help or make some suggestions. I have some basic experience in using ADC MCP3208, and also Schmitt trigger logic gate HC14. I am using Rpi3+, with linux stretch 2018apr. I once tried basic Rpi GPIO and MCP23017 interrupt experiments successfully and more or less understand the interrupt operation. I have about 2 years hobbyist programming experience in Rpi3 python 3.5. My current project is also in home automation. This repeated firing of the callback is mentioned in earlier postings. I use GPIO 23 as an output to turn a relay on to supply 24vdc to my rectified circuit. MCP3008 8-Channel 10-Bit ADC With SPI Interface for Raspberry Pi that I will use to read the voltage on GPIO pin 25 Pin 25 is initialized as a input GPIO with both rising and falling edge detects. By acceptable ripple I mean that it never goes low enough to trigger an edge detect on a Raspberry Pi 3b+ gpio pin. I have designed a small circuit that will convert the 24vac to ~3.3 dc with acceptable ripple. The valves are Rain Bird and their solenoid run on 24vac. If anyone is interested, I'll attach them to a different response. I have other diagrams and graphs but can't figure out how to attach them. I've tried different capacitors and resistors but can't seem to get the results I need. I'd like any suggestion anyone might have about how I can make the voltage fall steeper. My thought is that this will make the rise and fall steep enough to avoid this issue. My next experiment will be to try a Schmitt Trigger on the output of my rectifier. I'm uncomfortable with sleeping in a callback. In fact, the callback happens early and this is why the suggestion of some posting to delay the read of the GPIO pin for a few milliseconds works. The voltage range for reading the pin does not match the voltage at which the edge event occurs. The problem is that during the first few firings of the callback, the GPIO pin value is not consistent with the edge detection. The documentation mentions that the way to know if you have a rising or falling edge is to check the GPIO pin value. At about 1.2v I start reading the GPIO pin off but am still getting edge detections until about 0.7 v. I continue getting edge detections about every 0.4 ms and I can see the voltage dropping but the GPIO pin still reads ON until the voltage reaches about 1.2v. However, when I read the GPIO pin, it still reads ON. The first edge is detected at about 1.5 v. Once the 0.3 voltage is reached, the pyhon event list is written to a file where I can us MS Excel to graph it. When the 2 seconds are up the relay is opened but the looping continues until the voltage on pin 25 drops to less that 0.3 volts These items are added to a python list where I am logging events. At each iteration of the loop, the voltage is read, the GPIO pin is read and the time is noted. I add these values to a python list where I am logging events. When the callback occurs, I note the time and read the GPIO pin 25. However, the ripple does not go low enough to trigger a falling edge I close the relay, energizing my rectifier and supplying rippling ~ 3.0 v to the GPIO Pin 25. Initialize the GPIO pins and set up GPIO.BOTH edge detection on pin 25 to call my callback routine. ",%d"%conds + ".%06d"%measuretime.microseconds + Print "voltimelist len =", len(voltimelist)įor voltim, volts, state, pin, measuretime in voltimelist:įile.write( "%d"%conds + ".%06d"%mstime.microseconds + ", Count = " + str(avgvoltcnt) + ", state = " + str(state)) Finished! Average volts=" + str("%.4f"%avgvolt) + Timercount = int(testtime / sleeptime) + 1Īvgvolt = ((avgvoltcnt * avgvolt) + voltage) / (avgvoltcnt + 1) Measuretime = datetime.utcnow() - starttime Global state # 0 = not started, 1 = on, 2 = off, 3= zero reached Key = conds + mstime.microseconds / 1000000.0 # timediff.microseconds 7) or (adcnum >= 1 # first bit is 'null' so drop it # voltage = ad_value*(3.3 / 1024) # *5 no voltage divider here # ad_value = readadc(AO_pin, SPICLK, SPIMOSI, SPIMISO, SPICS) # change these as desired - they're the pins connected from the Code: Select all #!/usr/bin/env python2.7įrom time import sleep # this lets us have a time delay (see line 12)ĪO_pin = 0 #flame sensor AO connected to ADC chanannel 0
0 Comments
Leave a Reply. |