PICAXE 28x2 Modules + 4D Systems uOLED160 G1

dartec

Member
Hi, After having good help from many forum memebers and getting some very good pointers I feel I had to post my 'project' to date. This may be a basic project but I wish to add to the forum and hope it may help at least other new users like myself.

I intend to build a sensor measuring unit a bit like a tri-corder on Star Trek. To measure temp, distance, light and any other info as I progress. I found the 4D Systems uOLED 160 G1 displays which again mademe think nice unit bt what coudl I do with it. I use a PICAXE 28x2 Mudule unit as my microcontroller. So I have been testing ideas of how to generate a graph of number liek an oscilloscope and display numbers etc. So got a good start with info from Westaust55 for uOLED and Hippy with random numbers. I used random numbers to help me look at ways I could take a number and display it as a line graph and digits. Therefore I include a photo of the project (may put video of it on yourtube) and attached programme list.
 

Attachments

dartec

Member
Some help I could do with or improve on are:

1. Better way to display changing numbers - I used a method of printing the same number in back ground colour to stop the characters laying on top of each other thus producing a solid block over time.

2. The random numbers (as a reference as to why) appear to be always below 30 on the top window in red, the yellow ones appear to be between 30 & 60 and the green between 70 & 90 - why?

3. Speeding up the programme if possible.

4. And Oh yes make the programme it's self more optimised.

I have put plenty of remarks (I hope) but if anybody has got questions please let me know through this post and I will answer as best possible.

Cheers.
 

westaust55

Moderator
Some help I could do with or improve on are:

1. Better way to display changing numbers - I used a method of printing the same number in back ground colour to stop the characters laying on top of each other thus producing a solid block over time.
Rather than saving to old value and then reprinting each value again, I have taken the path of just printing a filled box in the background colour.
You could then quickly clear all three value regions at once so less time spent changing pen colours back and forth and then plot all three new values one after the other which will remove a tendency to flicker

2. The random numbers (as a reference as to why) appear to be always below 30 on the top window in red, the yellow ones appear to be between 30 & 60 and the green between 70 & 90 - why?
In your maths, the formula
B2 = W0 / 199 // 26 + 1
Ensures that the result is always a value between 1 and 26.

Then for the three graphs you calculate a Y axis offset as
Graph 1: Y = 28 - B2 ; so here Y is always in the range 2 to 27
Graph 2: Y = 61 - B2 ; so here Y is always in the range 35to 59
Graph 3: Y = 94 - B2 ; so here Y is always in the range 68 to 92
This is correct for determining the plot Y-axis position

Then lower down in the program you have the line
SEROUT B.7,T2400,($73,16,6,1,$FF,$E0,#Y,$00)
This prints the value of Y.
Instead of the #Y, print #B2 then the values at the right are always all in the range 1 to 26.

3. Speeding up the programme if possible.

4. And Oh yes make the programme it's self more optimised.
Suggest that you get the program doing exactly what you want first then look for optimisations.

For general speed up, you could look at:
1. Running the PICAXE chip faster. See the SETFREQ command (PICAXE Manual 2 page 185) for example, try SETFREQ m16
2. Using a faster serial comms speed to the uOLED display. The displays can accept comms speeds in the range from 300 to 256K baud.
So at 16MHz clock speed, try SEROUT B6, N9600_16, (your data here)
 

dartec

Member
Hi Westaust55,

Than you for the tips.
1. Will try this method.

2. Realise what I have done. Tested routine in a clean programme then cut and pasted without checking, yet look at at it many times without realising.

3. Tried faster baud but got funny things happening but it may have been doen to auto sync timings. Will try again.

4. Yes makes sense. Ihave added an LDR and going to get the reading to be graphed but after the above mod/corrections.

Cheers.
 

dartec

Member
Setfreq to 32mhz, re-did the variables and just tried T19200_16 and it's fast. So much it stops the flicker of the numbers.

Although when first re-programmed nothing happened until I pressed reset.

Cheers.

PS: these OLED are amazing and look cool in the dark (while testing the LDR), must save for the 3.2" with touch screen.
 

LarryGrad

Member
Opaque text

RE: post#2, Item 1. Text basically printing on top of itself.

Try the Opaque command. 4F 01

The default is Transparent, which is fine if you want to view a graphic image behind text, but bad if you want to update numbers on a screen.
 
Last edited:
Top