elektor lathe tacho project

Equipment, circuits, projects, procedures

elektor lathe tacho project

Postby spankysdad » Fri Dec 19, 2014 8:31 am

Has anyone built this project? I am having a problem compiling the software.
I get an error " Adafruit _SSD1306.h.131 : error redefinition of class Adafruit_SSD1306."
Both the project software ( called "Firmware" ) and the driver software SSD1306.h are defining the display module pins.
The Adafruit example code 128 x 64 SPI example works fine.
Does anyone know how to overcome this?
Many Thanks,
Phil
spankysdad
 
Posts: 7
Joined: Fri Dec 19, 2014 8:12 am

Re: elektor lathe tacho project

Postby ag » Thu Dec 25, 2014 6:06 pm

Hello Phil,

I have not built this project, but I was able to compile and transfer to my Duemilanove using Atmel Studio 6.2. I ran into several prolblems trying to get Adafruit files to match, but finally was able to compile the "Firmware.ino" using the SSD1306 files from this link https://www.pjrc.com/teensy/td_libs_SSD1306.html and the GFX files from this link https://github.com/adafruit/Adafruit-GFX-Library . Sorry to say that I cannot test the result, since I have not purchased the Adafruit hardware needed to test. Try it and see if you have any luck.

Regards,
Last edited by ag on Sat Jan 03, 2015 9:23 pm, edited 1 time in total.
Ag
ag
 
Posts: 532
Joined: Thu Jan 02, 2014 10:37 am

Re: elektor lathe tacho project

Postby spankysdad » Fri Dec 26, 2014 4:11 pm

Hi ag,
Thanks! i will try it.
Happy New Year.
Phil
spankysdad
 
Posts: 7
Joined: Fri Dec 19, 2014 8:12 am

Re: elektor lathe tacho project

Postby spankysdad » Sat Dec 27, 2014 3:33 pm

I found the answer to this problem in the Arduino tutorials. arduino.cc/en/hacking/library tutorial/ Writing a Library for Arduino.
the Adafruit_SSD1306.h needed to be modified.
To overcome this I added the lines
#ifndef adafruit_SSD1306_h
#define adafruit_SSD1306_h
before the header ( the part with the "include " functions in it )
and
#endif
at the end of the SSD1306.h code.
The Elektor "Firmware" code then compiled OK.
Phil
spankysdad
 
Posts: 7
Joined: Fri Dec 19, 2014 8:12 am

Re: elektor lathe tacho project

Postby ag » Sat Dec 27, 2014 4:35 pm

Hi Phil,

To me, that reads something like "if adafruit_SSD1306_h has not already been defined somewhere, then let´s do it now. Otherwise ignore this file". I don't like messing with vendor libraries (often ends up revenging itself later), but whatever works. ;)

Season's greetings,
Ag
ag
 
Posts: 532
Joined: Thu Jan 02, 2014 10:37 am

Re: elektor lathe tacho project

Postby allan2w » Thu Jan 01, 2015 12:22 pm

Hello,
I have built the project and after a few trials was able to load the software successfully, without the aforementioned error messages. However, now the tacho runs and the display is correct, but I am having problems getting a speed readout. It has displayed a speed, albeit incorrect a couple of times, but I can't get a reliable reading. I have checked the sensor, which appears to be working. Any ideas?

Regards
Allan
allan2w
 
Posts: 2
Joined: Thu Jan 01, 2015 12:09 pm

Re: elektor lathe tacho project

Postby spankysdad » Sat Jan 03, 2015 8:16 am

Hi Allan,
I have not tried my tacho on my lathe yet, but hope to do so over the next few days, when I have built the sensor up.
Two thoughts for you to think about in the meantime,
Is the time display updating the elapsed time ?
have you put the reflective strip and matt black tape on the shaft as shown on the u tube video?
The sensor needs to see a light / dark transition every turn of the shaft for it to work.
phil
spankysdad
 
Posts: 7
Joined: Fri Dec 19, 2014 8:12 am

Re: elektor lathe tacho project

Postby allan2w » Sat Jan 03, 2015 4:23 pm

Hello Phil,
The run time clock is working OK. I have tried several arrangements to trigger the sensor with no reliable success to date. I have confirmed that the IR LED is working OK and that the phototransistor is registering the mark. I have also checked the signal to the Arduino input pin. I have also changed the sensor without success. So I am running low on ideas at the moment. Any other thoughts would be appreciated.
Thanks Allan.
.
allan2w
 
Posts: 2
Joined: Thu Jan 01, 2015 12:09 pm

Re: elektor lathe tacho project

Postby ag » Sat Jan 03, 2015 7:02 pm

Hi Allan,

As I mentioned to Phil, I have not built this project, but looking at line 20 of the .ino file
Code: Select all
#define RPM_Sensor_Input 1 
and comparing to the schematic shown in the Elektor article, and in light of the problem you mention, I would suggest that the input signal is connected to the wrong pin, or conversely, code line 20 is defining the wrong pin for input.

Also note that the comment in code line 20
Code: Select all
//can be int 0,1,2, or 3 but NB: 2 and 3 is serial comms
can be misleading, since D0 is RX and D1 is TX, thus also "serial comms".

I would suggest changing line 20 to
Code: Select all
#define RPM_Sensor_Input 3 


What do you think?

Regards,
Ag
ag
 
Posts: 532
Joined: Thu Jan 02, 2014 10:37 am

Re: elektor lathe tacho project

Postby spankysdad » Sun Jan 04, 2015 9:39 am

I built the sensor assy up yesterday, and the project works.
My "firmware " software has the "#define RPM_sensor_ line_Input 1 line. I did not change it.
In fact the Rpm display reacts if you pass your fingers back and forth close to the sensor leds.
To test I used a strip of matt black card all around the shaft with a small piece of silver "mirror card" i bought from the craft shop glued on top.
spankysdad
 
Posts: 7
Joined: Fri Dec 19, 2014 8:12 am

Next

Return to Test & Measurement

Who is online

Users browsing this forum: No registered users and 2 guests