You're absolutely right.
500ms is too long and your solution is much more simple.
And most of the time, the simpliest is the best.
Thanks again, i'll share pictures and results
Announcement
Collapse
No announcement yet.
PICKINI V4 - an easy to build, self adjusting PI detector
Collapse
X
-
The code is basically OK, but the interrupts should NEVER be disabled here.
When you stop the interrupts for 500ms, the pulse to the coil - and the flyback pulses will also stop for 500 ms. Normally, they occur every 2 ms.
Because the entire analog front-end is AC coupled, the average DC balance will be disturbed by this and you will have to recover from this each time the interrupts are stopped.
Better is to add a counter and set the BEEP pin active for a number of timer interrupts ( x 500 microseconds).
Personally, I would just do something like:
if (pulsediff=64){
BEEP=1; //output 11=1
} else {
BEEP=0; //output 11=0
}
This will give a continuous signal as long as something is detected ( especially useful when the pinpoint button is active ).
No idea why you want a temporary signal - that could last even longer than the detection of a small target when you swing over it ?
Leave a comment:
-
like :
Comment the toggle pin 11 line
//BEEP = !BEEP;
and :
// Limit pulse diff
if (pulsediff > 64)
{
pulsediff = 64;
}
if (pulsediff=64){
INTCON.GIE = 0; // Disable interrupts
BEEP=1; //output 11=1
Delay_us(500000);
BEEP=0; //output 11=0
INTCON.GIE = 1; //enable Interrupt
}
Leave a comment:
-
Hi, thanks for your reply,
I first saw the definition of PWM_OUT but no use of it, that was puzzling me.
I don't want to use pin7 cause i've already etched one TH and two SMD boards.
Isn't it possible just to out a 500ms signal from pin 11 ?
Thanks
Leave a comment:
-
The audio signal is generated from the 500microsecond timer interrupt.
There is a hint in the code to use PWM - this results in a 1kHz audio output that will vary in pulse width and so in volume. I never liked this approach, but you can enable it by adding
#define PWM_AUDIO. This will not help you with the vibrator however...
When you look at the schematic: Pin7 of the PIC is a free output pin.
It can be used to drive a vibrator / LED ON/OFF like this:
We can now use pin 7 = pin RC3 as DETECTION_PIN like this:Line 22:
// I/O pins
#define DAC_OUT PORTA.RA0 // DAC OUT --> opamp DC offset
#define BEEP LATA.LATA2 // OUT audio -- PWM3 RA2 pin 11
#define PI_TX LATC.LATC5 // OUT MD pulse pin 5
>>> Add: #define DETECTION_PIN LATC.LATC3 // Digital detection output
This will switch the pin high when something is detected and switch the pin low otherwise.Line 520:
// Limit pulse diff
if (pulsediff > 64)
{
pulsediff = 64;
}
>> Add: if (pulsediff == 64)
{
DETECTION_PIN = 1;
}
else
{
DETECTION_PIN = 0;
}
Succes,
- Bernard
Leave a comment:
-
Hi Bernard,
First, let me thank you so much to share your source code for this detector. It's not usual and it's very kind.
As you know, i want to drive a vibrator with a NPN transistor and the output of the PIC.
I'm quite amazed by your code but i have troubles to identify the detection sequence that drive the PWM output cause i have no experience on timers and PWM.
I want to replace the PWM audio command by :
Disable Interrupt
500ms output high on PIN 11
output low on PIN 11
Enable Interrupt
Can you give me a hint about this ?
I'll continue searching by myself while waiting for your reply.
Thanks again. PIERRE
Leave a comment:
-
@reptooyep: Please keep us informed about the build - DIP version first ?
Post some pictures of the PCB's and the end result + performance.
@all: Happy New Year - all the best in 2017, including more coins than pulltabs
Thanks,
- Bernard
Leave a comment:
-
On the DIP version (not modifyed), i cable the vibrator directly
In place of the audio but in my SMD version, i power the vib. with a bc848 transistor.
To test my SMD version, i'm waiting for the PIC and the IRF740 on the way from China.
To flash with MPLAB, you have to open the HEX from the IDE and configure the project
With the pickit3 and just burn the PIC. MicroC can do the same but i did not install the programmer.
In fact, with this configuration, you have 3 ways to burn the PIC.
Leave a comment:
-
It was designed entirely with mikroC and the mikroC libraries, so I can assume that some library functions for timing delay, e.g. are not compatible with the MPLab libraries.The source from mikroC does not compile in MPLAB, is it normal ?
I wonder if you can not just attach the vibrator to the audio output. It wil click once every 2 s, but the 1kHz detection tone should result in a continous vibration signal ?
I only used MPLAB as an interface to PICKit3 to program the hex file generated from mikroC.Does MPLAB needs to be installed to make PICKIT working ?
You probably found this info on how to use PICKit3 directly with mikcroC ?
I never tried it, I just used MPLab because it worked for me like that for many years already...
Leave a comment:
-
I thought it did not work properly cause when i switch between mplab mode and pickit mode, i must reload the pickot bootloader.
Finaly, it seems to be the normal functionning.
My detector will work underwater, so, i'm not afraid of EMI and human activity.
Leave a comment:
-
Nice, make it work with led signal repto, and make it anti emi to
, cant use it near human machine activity, otherwise its perfect.
Leave a comment:
-
OK,
Thanks,
my issue was simple. As F117 says, this was a power ON issue .... So simple !!!
I'm not so bad at AVR programming but this is my first PIC test.
Last thing to do for me is to modify the source code in order to make it work with a phone vibrator to make an underwater detector.
I'll publish soon my SMD version with the new source after i'm sure it works. (The board is already etched).
The source from mikroC does not compile in MPLAB, is it normal ?
Last question :
Does MPLAB needs to be installed to make PICKIT working ?
Thanks a lot
Leave a comment:
-
Update firmware?
Wrong zip slot pin?
Compability program to xp sp2 for standalone software?
Leave a comment:
-
-
Hi, thanks for help.
I'll check for config file installation.
I measure 0v between VDD and VSS on the adapter board but i've checked the connections between pins of the chip and output of PICKIT3; everything is fine.
I've also tryed with a new chip.
I've also tryed with MPLAB mode and load the hex file from the IDE but i get a pickit error.
Strange ..
Leave a comment:
Leave a comment: