Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling problems in windows #2

Closed
RaffRJ opened this issue May 5, 2018 · 10 comments
Closed

Compiling problems in windows #2

RaffRJ opened this issue May 5, 2018 · 10 comments

Comments

@RaffRJ
Copy link

RaffRJ commented May 5, 2018

Using windows 64-bit machine

What I have done:
Copy the make.exe inside a folder with the SRC folder in it. When I envoke make, 1st problem it was looking for missing file.
[IMG]http://i65.tinypic.com/3145mhh.jpg[/IMG]

Now I have downloaded and installed python 3.6

Run the app and loaded python files. It returns error.
[IMG]http://i63.tinypic.com/34t1gup.jpg[/IMG]

@adamples
Copy link
Owner

adamples commented May 6, 2018

Ok, now I see the problem.

First of all you shouldn't copy make into repository. You just need to add it's directory to the PATH environment variable. Then you'll be able to run it from any directory. Please remove it before proceeding with these instructions.

Let's say you downloaded avr-gcc from here: http://blog.zakkemble.co.uk/avr-gcc-builds/ and unpacked to C:\avr-gcc-7.3.0-x64-mingw\. Then you open cmd, and add it to your PATH:

C:\vum> set PATH=C:\avr-gcc-7.3.0-x64-mingw\bin\;%PATH%

Please double check if this is a valid path to bin directory, which contains avr-gcc.exe and make.exe.

Now you can check if avr-gcc is recognized as a command:

C:\vum> avr-gcc --version
avr-gcc (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Same with make:

C:\vum> make --version
GNU Make 4.2.1
Built for Windows32
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

And Python:

C:\vum> python --version
Python 3.6.5

If all of that works, just execute make and you should get your build\main.hex file.

If you want to add avr-gcc to PATH permamently, use method described here: https://www.computerhope.com/issues/ch000549.htm.

@RaffRJ
Copy link
Author

RaffRJ commented May 6, 2018

Hey Adam!

Thanks for that clear instruction/s. Worked flawlessly! Now it generated a hex file. Few more questions:

This will generate hex file and no eep file?

I will try generated hex and burn it in a standard arduino mini(16MHz) using usbasp hardware. Changing the mcu clock to 16000000 in makefile file is valid, right?

@RaffRJ
Copy link
Author

RaffRJ commented May 7, 2018

Update:

Hardware now working. Xtal changed to 20MHz. I have tried your older code and meter needle never moves. Tried all analog inputs.

And then I compiled again your latest code "using single lcd" . Now the meter shows pegged. Still no response from analog input pin/s (assuming this gets audio signal from A0)

http://i68.tinypic.com/se7qq1.jpg

Am I still missing something here?

@adamples
Copy link
Owner

adamples commented May 7, 2018

It should work with 16MHz.

Currently code is reading ADC2 (A2 if you're using Arduino board). You can change that in main.c around line 93:

uint16_t adc_l = adc_get(2);

For example change it to adc_get(0).

Additionally you have to do either of these things to set reference voltage to 5V:

  • connect AREF to VCC or
  • replace line 17 in adc.c with this:
ADMUX |= _BV(REFS0) | channel;

The right solution depends on your board (how AREF is connected).

@RaffRJ
Copy link
Author

RaffRJ commented May 7, 2018

Got it!

So this is using Aref.no wonder 😀. My bad. Anyways at what voltage does the final op-amp output is with 0v input signal? Around 2.5v? Assuming using rail2rail output? I have here mcp602. Havent wired it yet according to your diagram.

Update:
Changed code to using A0. Tried replace 'line#17'.

Arduino pro mini has no exposed Aref pad.

Connected a 10k to analog. Low needle is around 2.398v.full peg is 0.849v. Now i get it. So the op-amp front is an inverting && on virtual GND || center vcc.

How do I un-invert the analog input? Sorry but I dont have experience with language.at least not yet 😴

Will definetly DO the hardware front-end soon..

@adamples
Copy link
Owner

adamples commented May 7, 2018

Yes, it will be somewhere around virtual ground, so 2.5V. If I remember correctly with input of sine wave with amplitude of ~0.5V it goes down to around 1.3V (I may be wrong about that, I tried many versions of this circuit).

In this code (main.c:93):

int16_t angle_l = (int32_t) (498 - adc_l) * 128 / 164;

498 is "zero" level, and 164 is scaling factor. You can adjust it to be more or less sensitive. Additionally you can change gain of input stage by changing the 47k resistor.

In my prototype I used mcp6002 which has both rail-to-rail inputs and outputs.

@RaffRJ
Copy link
Author

RaffRJ commented May 7, 2018

Copy that. So if I change 498 to 0, would this mean also as "referenced to GND"?

and how do I turn off or disable Aref?
ADMUX |= _BV(REFS0) | channel;
Same with this one?

@RaffRJ
Copy link
Author

RaffRJ commented May 9, 2018

Adam
All is working now. Thanks.
Now working in reverse color.
https://youtu.be/Ex-LrSymweo
Btw, how do you make the "peak detector" work?

Cheers man!

@adamples
Copy link
Owner

adamples commented May 9, 2018

Cool 😎
With peak indicator it depends on what you want to achieve. If you are concerned with accuracy you can add a peak detector like described here: https://www.youtube.com/watch?v=jllsqRWhjGM , and attach it to second ADC pin.
Or you may just determine if it's active by position of the needle. This just requires adding peak indicator to refresh routine. I will try to fix this when I only have some time.

@adamples
Copy link
Owner

Ok, I added quick fix to both main and single_display branches: e31dd53

Currently the code checks for needle angle to make peak indicator visible (main.c:106):

PEAK_INDICATOR_SPRITE.sprite.visible = (angle_l > 192);

@adamples adamples mentioned this issue Jun 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants