PDA

View Full Version : EASYPIC4 Board Giveaway



rmteo
- 7th April 2011, 16:20
I have one of these that I no longer need (no GLCD). We can do another contest similar to the last one.
5332
Walter, do you want to administer this one as well?

rmteo
- 7th April 2011, 18:08
The objective of the contest is pretty simple - to pulse/blink a minimum 4 LEDs (more is better) at independent, variable rates using any PIC of your choice. The actual blink rate is not important, as long as it is visually discernible. Also, the method to adjust the blink rate is unimportant - you can use POTs on ADC channels or whatever method you want.

Sounds easy? There's a small catch though - each LED must ramp-up and ramp-down in brightness from 0 to 100% and NOT just toggle hard-on and hard-off.

cncmachineguy
- 7th April 2011, 20:14
RMTEO, Hats off to you this is very generous.

Now I realize this new contest hasn't been approved yet, but I have 1 question. Should the intensity change with each blink, ie each LED will need to blink 200 times to go through the full ramp up/ramp down?

This is a very good contest idea. Thank you!! (did I mention I love puzzles?)

rmteo
- 7th April 2011, 22:31
The blink rate/frequency has to be adjustable for each of the LEDs. For every blink, each LED should ramp from 0-100-0% brightness. Perhaps this video of 2 LEDs will give you a better idea (note that the blink rate is different for each LED).


http://www.youtube.com/watch?v=aV_EhVvKEAg

mackrackit
- 8th April 2011, 06:14
Blinky ideas??
http://www.picbasic.co.uk/forum/showthread.php?t=11447&pagenumber=

rmteo
- 8th April 2011, 14:50
Blinky ideas??
http://www.picbasic.co.uk/forum/showthread.php?t=11447&pagenumber=
Unfortunately, none of those ideas will qualify - they are just simple ON/OFF blinkies. Take a look at the attached drawing. The horizontal axis is time and represents the blink rate. The vertical axis is the LED brightness. The post that you linked to is like the upper trace. What I am looking for (as in the video above) is shown in the lower trace.

Also, the blink rate (or period) needs to be adjustable by some method of your choice. A minimum of 4 LEDs/channels are required. The blink rate of each LED needs to be adjustable independently and should not affect any of the other channels.

rmteo
- 8th April 2011, 16:09
Hopefully senior members (who may not wish to participate in the contest) will chime in with tips/tricks and/or code snippets to help the less experienced get started.

ScaleRobotics
- 8th April 2011, 16:31
Walter, do you want to administer this one as well?

Seems like you are doing a fine job rmteo, and great challenge! If you still want help, let me know, I would be happy to.

Is Mibam allowed, or is that cheating? http://www.picbasic.co.uk/forum/content.php?r=217-MIBAM-%28Mirror-Imaged-Bit-Angle-Modulation%29 .

rmteo
- 8th April 2011, 16:43
Thanks for your offer. I will handle it for now. You could move this to a more appropriate forum if you think it should be.

Any technique (including MIBAM) is good.

rmteo
- 9th April 2011, 00:26
Feel free to ask questions or to have any points clarified.

rmteo
- 10th April 2011, 15:39
....Should the intensity change with each blink, ie each LED will need to blink 200 times to go through the full ramp up/ramp down?

This is a very good contest idea. Thank you!! (did I mention I love puzzles?)
How is the puzzle solving coming along? Getting close yet?

rmteo
- 12th April 2011, 15:01
...Is Mibam allowed, or is that cheating? http://www.picbasic.co.uk/forum/content.php?r=217-MIBAM-%28Mirror-Imaged-Bit-Angle-Modulation%29 .
Were you able to do it using MIBAM?

cncmachineguy
- 12th April 2011, 15:11
Is this a first valid answer wins contest, or post and vote.

ScaleRobotics
- 12th April 2011, 15:41
Were you able to do it using MIBAM? Thanks rmteo. My question was more to hint at a possible solution for others, and to get a scope of the rules. You have laid out two nice possible paths to get it done.

rmteo
- 12th April 2011, 16:02
Is this a first valid answer wins contest, or post and vote.
The person to come up with a working solution first wins - NO voting this time. The end date will be 30th April, 2011.

You want to start posting about your potential solution as early as possible as it may affect the final outcome. Good luck and have fun!!!

cncmachineguy
- 12th April 2011, 18:09
How is the puzzle solving coming along? Getting close yet?

The puzzle is coming along fine, I have it on a slow simmer. :)

Right now I am trying to decide on min and max frequencies. I am thinking .5 to 1000 Hz. But clearly 1K will look just full on, so I may go with 500hZ. Anything less then .5hZ will just be painful to watch.

Also trying to work out resolution for the frequency. Seems like it should not be linear with the pot adjust.

rmteo
- 12th April 2011, 18:28
Some pointers to take note of:

1. The variable/controllable blink rate should range from about 0.5Hz to no more than 8Hz - anything faster will appear as a flicker, which you do not want.

2. As the LED goes from full OFF to full ON and back to full OFF, its brightness has to be varied using some kind pulse modulation such as PWM or MIBAM. The frequency of this modulation has to be high enough that there is no flickering as the LEDs pulsate. Refer to the video and especially the drawing posted previously.

In essence, each of the LEDs is being driven by 2 modulated signals at the same time. A low frequency one from 0.5-8Hz which is the blink rate and a higher frequency one that controls the 0-100-0% percent brightness ramp which gives the LEDs a pulsating effect - instead of just going OFF-ON-OFF.

Hint: Think FM.

cncmachineguy
- 12th April 2011, 19:19
Thanks for the more refined parameters. This should help us all. It at least helps me to not have to decide on the spread. :)

The hint is very nice, thank you. I guess my solution is that, but haven't thought about FM since college. As soon as I could get away from analog I did. Guess thats why I am a machinists. LOL

rmteo
- 12th April 2011, 20:12
I hope I have not confused you (or anyone else) with these explanations. Trying to put the concept into layman's terms is lot trickier than I thought. In technical terms the objective is:

To create 4 independently controllable, low frequency (0.5-8Hz) channels of analog signals (triangle waveform in this case) using digital modulation (such as PWM) with the LED's acting as a low-pass filter.

Now that sounds a lot easier to do, doesn't it? ;)

cncmachineguy
- 12th April 2011, 21:24
Well actually I thought it was fine before.

rmteo
- 15th April 2011, 17:51
Bert, have you made progress? Looks like no one else (besides Walter and yourself) has a solution for this contest. Do you (Walter, or anyone else) feel that perhaps it is too difficult and the contest should be changed to something simpler?

cncmachineguy
- 15th April 2011, 19:08
PM sent :)

larryvc
- 15th April 2011, 19:19
Anything less then .5hZ will just be painful to watch.

I might fall asleep watching at that rate. Working on ideas.

Hi rmteo.

larryvc
- 15th April 2011, 19:26
Bert, have you made progress? Looks like no one else (besides Walter and yourself) has a solution for this contest. Do you (Walter, or anyone else) feel that perhaps it is too difficult and the contest should be changed to something simpler?

rmteo,

From a mutual friend (mathematical place holder) on another forum:


What you kidding me? it's not rocket science.;)

rmteo
- 26th April 2011, 18:19
Four days to go - and it looks like there may be only one entry. :):):)

Demon
- 27th April 2011, 02:43
I just saw this contest now.


<---- darn tag under my name... :D

That is a very nice experiment board. I've been using the Lab X1 lately.

rmteo
- 27th April 2011, 15:51
I thought the GLCD was misplaced but I found it so the development board is like in the 1st. post. It comes with a PIC18F4620 - you can use any PIC16F or PIC18F in 40, 28, 20, 18, 14 and 8 pin DIP packages. I installed a ZIF socket in the 40-pin position.
http://www.picbasic.co.uk/forum/attachment.php?attachmentid=5332&d=1302189493
If anyone is interested, I have a PDF of the manual (it is too large at 2.5MB to upload).

cncmachineguy
- 27th April 2011, 17:16
Oh! The prize gets even better. Is anyone working on this contest? I hate to see a great prize and contest not even attempted!

rmteo
- 28th April 2011, 17:51
Oh! The prize gets even better. Is anyone working on this contest? I hate to see a great prize and contest not even attempted!
Looks like nobody else, besides yourself, has any interest in this. So post your solution and lets see if you are the winner.

cncmachineguy
- 29th April 2011, 15:04
you have shamed me into it. LOL!

I am putting it together now, likely I will slide in just under the april 30 deadline.

cncmachineguy
- 29th April 2011, 18:52
Heres my code so far. It appears to work as needed, but thus far I have only tested it with a sim. I will try and put the hardware together tonight and test it in real time.


' Name : RMTEO Contest 2.pbp
' Compiler : PICBASIC PRO Compiler 2.6A
' Assembler : MPASM
' Target PIC : 16F1947
' Hardware : RMTEO Contest
' Oscillator : internal
' Keywords :
' Description : PICBASIC PRO program to drive 4 LED's at independent speeds
' adjustable from 4 pot's. fade from 0-100-0% for each cycle
'
'
'
'
' Configure ports
'
'
ANSELA = %00001111 'port A 0-3 analog 4-7 digital
ANSELE = %00000000 'port E all digital
ANSELF = %00000000 'port F all digital
ANSELG = %00000000 'port G all digital
CM1CON0 = %00000000 'No comparaters
CM1CON1 = %00000000
CM2CON0 = %00000000
CM2CON1 = %00000000

' preload latches before setting direction

LATB = %00000000
LATC = %00000000
LATD = %00000000 'LED's 0 for red, 1 FOR GREEN should start red
LATF = %00000000 ' low nibble is drive enable. 1 disables
LATG = %00000000

' I/O direction

TRISA = %00001111'x,x,x,x,p3,p2,p1,p0
TRISB = %00000000'x,x,x,x,led3,led2,led1,led0
TRISC = %00000000'UNUSED
TRISD = %00000000'UNUSED
TRISE = %00000000'UNUSED
TRISF = %00000000'UNUSED
TRISG = %00000000'UNUSED


'REMOVE THIS LINE IF NOT SETTING THE CONFIGS IN CODE SPACE

@ __config _CONFIG1,_FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
@ __config _CONFIG2,_WRT_OFF & _VCAPEN_OFF & _PLLEN_ON & _STVREN_OFF & _LVP_OFF ;_BORV_25

'------------------Internal osc setup
OSCCON = %11110000 'clock is 8 meg. turn on PLL for 32 meg clock
DEFINE OSC 32
DEFINE NO_CLRWDT 1

'Variables

'Port assignments

'------------------port B

'---------------------words
freqs1 var word
freqs2 var word
freqs3 var word
freqs4 var word
freq1 var word
freq2 var word
freq3 var word
freq4 var word

'---------------------Bytes
TICKS VAR BYTE
display VAR BYTE
duty1 VAR BYTE
duty2 VAR BYTE
duty3 VAR BYTE
duty4 VAR BYTE
myflags var byte

'---------------------Bits
led1 var display.0
led2 var display.1
led3 var display.2
led4 var display.3

df1 var myflags.0
df2 var myflags.1
df3 var myflags.2
df4 var myflags.3
'---------------------INIT VARIABLE VALUE

GOTO START
MYINIT:
BSR = 0
TICKS = 0
freqs1 = 128
freqs2 = 256
freqs3 = 512
freqs4 = 1023
duty1 = 0
duty2 = 0
duty3 = 0
duty4 = 0
display = 0
MYFLAGS = 0

'-------------------A/D setup
adcon0 = %00000001
adcon1 = %11100000
define ADC_BITS 10

'-------------------10uS interrupt setup
DEFINE INTHAND _TimeBase
PIR1.1 = 0
PIE1.1 = 1 ; Enable Timer2 interrupts
INTCON.6 = 1 ; enable PEIE
INTCON.7 = 1 ; enable GIE
T2CON = %00000100 ; Setup Timer2 AND SET PRESCALE TO 1:1. @32Mhz THE Interrupt
PR2 = 39' FOR TMR2 WILL BE 10uSec
RETURN

'---------------------start of program
START:
GOSUB MYINIT
MAIN:

adcin 0,freqs1
'-------------------------led1 math
if ticks>duty1 then
led1 = 0
else
led1 = 1
endif
if freq1 > freqs1 then
if df1 then
duty1=duty1+1
else
duty1=duty1-1
endif
if duty1=100 then df1=0
if duty1=0 then df1 = 1
freq1 = 1
endif

adcin 1,freqs2
'------------------------led2 math
if ticks>duty2 then
led2 = 0
else
led2 = 1
endif
if freq2 > freqs2 then
if df2 then
duty2=duty2+1
else
duty2=duty2-1
endif
if duty2=100 then df2=0
if duty2=0 then df2 = 1
freq2 = 1
endif

adcin 2,freqs3
'------------------------led3 math
if ticks>duty3 then
led3 = 0
else
led3 = 1
endif
if freq3 > freqs3 then
if df3 then
duty3=duty3+1
else
duty3=duty3-1
endif
if duty3=100 then df3=0
if duty3=0 then df3 = 1
freq3 = 1
endif

adcin 3,freqs4
'---------------------------led4 math
if ticks>duty4 then
led4 = 0
else
led4 = 1
endif
if freq4 > freqs4 then
if df4 then
duty4=duty4+1
else
duty4=duty4-1
endif
if duty4=100 then df4=0
if duty4=0 then df4 = 1
freq4 = 1
endif
GOTO MAIN

'-----------------------ISR
TimeBase:
BSR = 0
portb = display ' update led's

freq1 = freq1 +1
freq2 = freq2 +1
freq3 = freq3 +1
freq4 = freq4 +1
if ticks >99 then
ticks = 0
else
ticks = ticks+1
endif

pir1.1 = 0 ' clear interrupt
@ RETFIE


All comments welcome. I did this all software (no hardware PWM) as I thought it would be more fun.

Thanks for the contest RMTEO! Sorry I seem to be the only one entering.

rmteo
- 30th April 2011, 16:53
Yes, it will be interesting to see how it works!

cncmachineguy
- 30th April 2011, 17:13
Well I am done at work today, so home I go and hopefully get this put together and running. :)

Then to figure out about posting video - always something new and fun

cncmachineguy
- 30th April 2011, 23:00
OK, I have my working do-hicky video'ed. Anybody have any suggestions how to get it from my iphone4 to here?

I know how to upload it to facebook, but what good is that?

ScaleRobotics
- 30th April 2011, 23:05
If you can get it to youtube, that is probably the easiest way. Then add the link to your post, like this {video}your youtube link{/video} but with the other kind of brackets.

cncmachineguy
- 30th April 2011, 23:16
Oh dear. Guess it's time I learn to post on you tube now. I hope I figure it out before the deadline. Ok, I'll be back in a little bit.

rmteo
- 30th April 2011, 23:38
Don't worry about the deadline.

cncmachineguy
- 30th April 2011, 23:57
well you know, i have created the youtube account. sent the video to youtube via my phone. Now I just need to find the video on youtube. seems this part is the hardest.

cncmachineguy
- 1st May 2011, 00:06
I did it (I think)


http://www.youtube.com/watch?v=5rkDxDKvgNs

whats better? getting my entry in or posting my first video? Hmmmm

rmteo
- 1st May 2011, 00:33
Looking at the video, it sure looks like you did it. Can you confirm that the drive to the LEDs looks similar like this (only two channels shown) - you don't have to make a video of the scope trace.


http://www.youtube.com/watch?v=YtH0BTmyaFM

cncmachineguy
- 1st May 2011, 02:21
It looks like that on my sim scope. Not as locked in, but my pico-scope doesn't trigger that well either.

rmteo
- 1st May 2011, 02:32
Great, thanks. PM your address and I will get the EasyPIC4 out to you.

cncmachineguy
- 1st May 2011, 02:59
Ok, will do. Thank you Rmteo!

cncmachineguy
- 1st May 2011, 03:25
This is the sim scope. Now I am just having fun, learning how to do all sorts of new stuff


http://www.youtube.com/watch?v=Eec-lAhN0Po

rmteo
- 1st May 2011, 03:53
....learning how to do all sorts of new stuff.
That was the intent of the contest. Glad that you are having fun.

cncmachineguy
- 1st May 2011, 19:46
If anyone is interested, I have a PDF of the manual (it is too large at 2.5MB to upload)


Just read the manual. It is available online. :) thanks for the offer.

Quick question, all the pictures show both the GLCD and the LCD in place at different locations on the board, but the manual indicates the LCD plugs into the same pins as the GLCD. Any clarity for that?

rmteo
- 1st May 2011, 20:24
The GLCD can only be used in its dedicated slot near the bottom of the board. The LCD can be used in its own slot (in 4-bit or 8-bit mode) near the top-left of the board or in the GLCD slot (only in 8-bit mode).

rmteo
- 2nd May 2011, 16:54
I am sending the EaspyPIC4 to you today via USPS Priority Mail.

Demon
- 2nd May 2011, 18:05
Thank you for a very informative contest and prize rmteo.

And congrats to Bert!

Those scope videos are cool too.

cncmachineguy
- 3rd May 2011, 09:38
I am sending the EaspyPIC4 to you today via USPS Priority Mail.

Thank you :)

cncmachineguy
- 3rd May 2011, 10:43
And Thank you Robert :)

cncmachineguy
- 6th May 2011, 15:32
WHoo Hoo, I have my Prize!! Thank you RMTeo for the contest and the prompt shipment of the prize. :):)