I'm quite new to electronics but am having a go at making an altimeter. I've made a schematic for my project, but as this is all new to me, and self taught, I wondered if any of you kind and experienced folk would mind checking my schematic please?
Click on the image below for a larger version, or download the original here.
[
What do you want it checking for? It's quite complex, which, given you said you are new to this, makes me suspect you didn't create it but got it from somewhere else. If you did create it then you'll understand how it is supposed to work, so, please can you describe its function and mention any bits you are not sure about.
You are going to be hard pressed to get 3.6 volts regulated from a 3.7 volt supply. The data sheet shows 0.13 volts difference typical, 0.25 volts difference over temperature, but the test conditions use an input voltage of 2.2 volts.
Driving headphones from a digipot seems sketchy as well but I don't know these other parts.
Do you need an ATMEGA1284 ? I'm guessing that you have already prototyped this somehow and discovered you need the extra RAM that it offers over say an ATMega328P.
Consider bringing out an ICSP header for programming the bootloader.
Consider using a standard 6 pin FTDI type header for normal programming / serial console connection etc. This makes it easier to use a cheap USBTTL type serial device.
Possibly consider eliminating the battery power selector. Look at some schematics for boards which have a battery charger socket to see how to do this.
No need to reinvent the wheel: You have got a ready made project of an altimeter based on an ESP8266.
You should find it easily...
Moreover if you chose the WemosD1 format, you will get a ready made shield for the OLED display and another stackable one to power it from a LiPo Cell.
What is the purpose of a loudspeaker for an altimeter?
Wow, thanks for all you responses guys! It's fantastic that you've all given your time to try to help me. Your input is greatly appreciated.
To keep things tidy I'll respond to all your comments in one post...
vaj4088:
Driving headphones from a digipot seems sketchys.
What makes you say this?
6v6gt:
4. Possibly consider eliminating the battery power selector. Look at some schematics for boards which have a battery charger socket to see how to do this.
6v6gt, I'll answer your other questions below, but I didn't fully understand this one. Could you elaborate please?
RIN67630:
No need to reinvent the wheel: You have got a ready made project of an altimeter based on an ESP8266.
What is the purpose of a loudspeaker for an altimeter?
An altimeter was a very simplified term to describe my project, I'll explain it in more detail below. Out of curiosity, I looked at the ESP8266, it's a wifi module no?
PerryBebbington:
What do you want it checking for? It's quite complex, which, given you said you are new to this, makes me suspect you didn't create it but got it from somewhere else. If you did create it then you'll understand how it is supposed to work, so, please can you describe its function and mention any bits you are not sure about.
This is indeed my own work. I feel a little bit smug that you thought it wasn't Hopefully that's a good sign
It started life following this diagram which I found online and has evolved from there:
Project Overview:
It's an Alti-Vario - an altimeter used by pilots of small aircraft. I'm using it for paragliding. It's main function is to beep and flash when you're altitude either increases or decreases (although it does a lot more than this).
Altitude, and lots of other things, are displayed on a small OLED screen.
I also have two buttons which enable me to change lots of settings.
One button has a red LED and the other has a green LED.
When the aircraft is sinking, the red light flashes, and when it's lifting the green light flashes. I've also added in an emergency SOS feature using the LEDS.
Here are some photos of my current working prototype.
Since making this prototype, I have updated my schematic. The main changes between the schematic and the version in the photos are removing the buzzer and replacing it with a speaker, adding a transistor to amplify the volume, and getting rid of the ribbon cable (the next one will be on a single PCB).
Schematic Overview:
Looking at the schematic, top left is a USB battery charger. I got this part of the schematic from the MCP73831 datasheet. The datasheet was a bit vague on the transzorb (see p18 of datasheet), so I've gone with a PESD5V0V1BA. Is this suitable? I looked at breakout boards using this MCU but they all omitted the transzorb.
In the "Off" state, the DPDT switch connects the MCP73831 to the battery, and also connects the USB plug to the red LED, to show the user that the device is charging. When fully charged, the green LED lights up. In the "On" state, the DPDT switch connects the battery to the 3.6v regulator and the ATmega1284p, as well as connecting the red LED to the ATMega1284p.
Bottom left is the ATMega1284p. The first prototypes were done using an Arduino Nano but I ran out of programming space. I upload a bootloader to the chips before soldering them to the board. To program the board, I'm using the Arduino IDE (with Mightycore) via a USB to Serial converter which plugs into a JST SH socket on the bottom of the PCB.
Bottom Middle are the two momentary switches with LEDs, nothing complicated here.
Top Right is the air pressure sensor, a BOSCH BMP388. Again, I've gone with the circuit recommended in the datasheet.
Below the BMP388 is the 3.6v regulator. Again, I've used the recommended circuit from the datasheet. I'm using a 3.6v regulator because this is the max voltage for the BMP388 and the OLED display. Originally I was using a 3.3v regulator, can't remember why I changed it. Maybe it couldn't handle the 4.2v of the battery when it's fully charged.
Bottom right is all about audio output. I have a digital pot to adjust the volume. This goes to a headphone socket. After the headphone socket I have a transistor to amplify the volume to the onboard speaker. I asked for help with this part of the schematic last night in another thread.
Problems / Questions
I've basically cobbled together the example circuits from the different datasheets. And combined it with the transistor amplifier as suggested on the forum. Most of all, I'd like some experienced folk to have a look at my work to see if they can spot any problems.
Most of the datasheets included decoupling capacitors. These have all made there way into my schematic. Is this overkill or can I get rid of some of them. Both space and weight are a premium in my project so if I can get rid of any components then that would be a bonus.
I did leave an earlier prototype charging over night and the next morning the battery wasn't charged and it would no longer charge after that. I've identified that the problem is not the battery. I've since modified my PCB design to move the MCP73831 closer to the battery and added holes in the PCB to help with cooling (Although I haven't tested if it's actually getting hot yet). Is there anything in my design which helps to identify what went wrong?
On the version in the photographs, when I first switch it on, the pressure sensor doesn't work. If I turn it off and back on again, it works fine. It does this every time I switch it on. Is there anything that can be seen in the schematic that might cause this? I have the 3.6v regulator on the opposite side of the board to the sensor, could this be the problem? The sensor needs to be kept away from any components which might generate heat.
In the schematic, everything between the headphone socket and speaker are untested, so I'd like this to be looked at please. The schematics I looked at were for 12v and an 8 Ohm speaker. Do I need to modify the components and/or circuit for a 3.7v battery and a 7.2 Ohm speaker? Also, is this transistor suitable? There were lots of Arduino projects online using a 2N2222 transistor. The one I plan to use is basically the closest match I could find for the 2N2222 in a surface mount package.
Are all of the components I'm using suitable? I appreciate this is a difficult question to answer without reading all of the datasheets.
As I say though, most of all, you guys might be able to look at my schematic and notice something wrong which I've completely missed.
PerryBebbington:
This is indeed my own work. I feel a little bit smug that you thought it wasn't
++Karma; // I guess you deserve that then!
Deserve what?
PerryBebbington:
I think your comment Was a bit misleading, as you are obviously doing rather well.
Thank you for the compliment, although I'm not sure why you are so keen to keep calling me a lier. There's lots of evidence I can provide to support my argument that this is new to me, but I don't think that taking the time to do so would be particularly useful and it would detract from the purpose of this thread.
I said that using a digipot was sketchy because many digipots cannot handle the voltage or the current required for headphones. I have not looked up the datasheet for YOUR digipot to determine if it is sufficient.
I may have misunderstood but it seemed to me that PerryBebbington was being complimentary and not that he was calling anyone a liar. It seemed to me that PerryBebbington WOULD have helped you IF you had needed any help. Perhaps you need help (holes in a PCB don't help thermally unless there is plenty of air flow, linear regulators tend to be heat sources and should NOT be placed behind heat sensitive components) but very little.
Nice looking prototype, how did you program it without ISP? Those processors normally come without bootloader installed.
Why using a 3.6V regulator rather than 3.3V? Anything that can't handle the full battery voltage of 4.2V? Or you could even do without regulator.
If you want to shrink it down a bit consider leaving out the crystal, running the ATmega from its internal 8 MHz oscillator instead (value of the crystal is not indicated; shouldn't be 16 MHz as operating voltage is too low for that).
The Karma I gave you. See your Karma, it's gone up, that was from me, it was a compliment!
Thank you for the compliment, although I'm not sure why you are so keen to keep calling me a liar.
Eh? I'm not calling you a liar, I'm saying you are more knowledgeable and experienced than you are saying, that could be because you don't feel that experienced, it could be because I misunderstood your level of experience. I don't doubt you honestly reported what you consider to be your level of experience and knowledge, but compared to others here who claim not to know much you are an expert.
glyndav:
An altimeter was a very simplified term to describe my project, I'll explain it in more detail below. Out of curiosity, I looked at the ESP8266, it's a wifi module no?
Yes it is a WiFi module, which includes a very powerful processor, more powerful than the one of your Mega!
You may switch the WiFi off, once you have got the time from the NTS and flown away to save power.
Since you are aiming at an ambitious project, i'd start with a ESP32 module with built in OLED display and LoRa long range transceiver, you will be able to feed your data to a car based data receiver over up to 20 miles in line of sight!...
vaj4088:
I may have misunderstood but it seemed to me that PerryBebbington was being complimentary and not that he was calling anyone a liar. It seemed to me that PerryBebbington WOULD have helped you IF you had needed any help.
Yes, indeed, thank you. Anyway, it seems others have managed to offer help I was not able to give.
++Karma;
vaj4088:
I said that using a digipot was sketchy because many digipots cannot handle the voltage or the current required for headphones. I have not looked up the datasheet for YOUR digipot to determine if it is sufficient.
Thank you for clarifying. Are you, or anybody else, able to suggest how I would go about determining if my digipot is sufficient?
wvmarle:
Nice looking prototype, how did you program it without ISP? Those processors normally come without bootloader installed.
With one of these.
I actually used Eagle to design a HAT that sat between that adaptor and an Arduino Uno. It was kind of a fun project to support my learning.
wvmarle:
Why using a 3.6V regulator rather than 3.3V? Anything that can't handle the full battery voltage of 4.2V? Or you could even do without regulator.
I'd have to think quite hard and do some research about why I made that change. Is there a good argument to use 3.3v instead of 3.6v? I don't see how I could do without a regulator though, could you explain this further please?
wvmarle:
If you want to shrink it down a bit consider leaving out the crystal, running the ATmega from its internal 8 MHz oscillator instead (value of the crystal is not indicated; shouldn't be 16 MHz as operating voltage is too low for that).
I read this in the datasheet. With the voltage I'm using, my understanding is that 16mhz is like overclocking a CPU, is that right? I calculated that the correct crystal to use would be 12mhz. All of my protoypes have been working fine at 16mhz. Do you think I should change it? It's a pretty hefty program that I'm writing, currently 3,417 lines of code, and the compiled file is 40972 bytes. The internal clock runs at 8mhz, I haven't tried running my code on the internal clock, but I Figured it made sense to go for the better performance. Please correct me if you think I'm wrong.
vaj4088:
I may have misunderstood but it seemed to me that PerryBebbington was being complimentary and not that he was calling anyone a liar. Perhaps you need help but very little.
PerryBebbington:
The Karma I gave you. See your Karma, it's gone up, that was from me, it was a compliment!
Eh? I'm not calling you a liar, I'm saying you are more knowledgeable and experienced than you are saying, that could be because you don't feel that experienced, it could be because I misunderstood your level of experience. I don't doubt you honestly reported what you consider to be your level of experience and knowledge, but compared to others here who claim not to know much you are an expert.
Apologies, I misunderstood your comment regarding Karma. I read it as, I had done something to generate bad karma, and therefore deserved any flack that followed. Thank you for giving me Karma and enlightening me on the forum's point system
I am new to this though. My expertise is 3D Graphics. You can see my demo real here. For the past few years I've been more focused on 3D printing than 3D graphics though. Prior to this I studied web design and programming. So for the programming side of the project, I have "lots" of experience, is just the electronics that are new to me.
Don't get me wrong, this isn't something that I've whipped up over night. It's taken me months to get this far.
You can see that in December, I replied to this thread and at this time I didn't know what the schematic symbol for a potentiometer was.
This isn't my very first foray into electrics though, I have done a couple of simple projects on the Rasberry Pi, and I have used an Arduino once before. This was to try and make my daughter a wheelchair. Video here. The electronics on this project were very simple though as I was using off-the-shelf components. More details on the mountain wheelchair project here if anybody is interested. Oh, and I also built my own 3D printers (which also use Arduinos) but these were in kit form and all I had to do was follow instructions on youtube. I didn't really understand what I was doing. However, what I did get from both of these projects is a a grounding in using the Arduino and some very basics of electronics.
So, not everything in this project is completely new to me, however, a lot of it is, and as I say, it's taken months of work and research to get to this point. Yes, I've produced a schematic, but this is mostly a kit-bashing of examples in datasheets. I don't have the experience to recognise any problems in my design, or ways to optimise it.
glyndav:
Apologies, I misunderstood your comment regarding Karma. I read it as, I had done something to generate bad karma, and therefore deserved any flack that followed. Thank you for giving me Karma and enlightening me on the forum's point system
I am new to this though.
Glad we cleared that up! In my opinion you are not new to this at all! You are reasonably experienced and doing very well at it. I have nothing useful to add to the information given to you by others other than to wish you good luck with your project. Good luck.
glyndav:
With one of these.
I actually used Eagle to design a HAT that sat between that adaptor and an Arduino Uno. It was kind of a fun project to support my learning.
[/quote[
Interesting way of programming. For now I'll stick to adding an ISP header & using the USBAsp programmer. Seems more convenient to me, especially for later reprogramming (even more so if that's done by someone else).
In a recent design I added an FTDI connector as well, works wonders for Serial debugging but it wouldn't upload code reliably that way. In the end I just stuck to ISP for that, and FTDI for debugging.
I'd have to think quite hard and do some research about why I made that change. Is there a good argument to use 3.3v instead of 3.6v? I don't see how I could do without a regulator though, could you explain this further please?
3.3V needs a regulator of course but you can get there more reliably from a LiPo battery, as you always have sufficient voltage to drop (until the very end).
The other option is to not use a regulator at all, just use the raw voltage of the battery. For the ATmega no problem, for the sensor maybe a problem, check the data sheet. If it can handle 4.2-4.3V (the highest voltage a fully charged LiPo cell produces) that may be the way to go. After all for many electronics the actual voltage doesn't matter, as long as it is within a certain range! That range is given in the data sheet of the different parts. As you have a charger connected as well, this may cause problems as the charger must supply a higher voltage than the battery voltage to be able to charge it.
For an ATmega the minimum specified voltage for 16 MHz is 3.78V, so at 3.6V you're overclocking (in spec would be 15 MHz), but I'm not surprised it still works well as it's so little. The specification is a guaranteed minimum; not a hard cut-off. For a one-off, self use project I wouldn't fret about it, if you're going to mass produce it it becomes a different story.
If you use a 12 MHz crystal you need 3.06V, that's well below the cut-off of the LiPo battery.
Whether you need 8, 12, 16 or even 20 MHz doesn't have much to do with the size of your code, but with what it has to do. Fast enough is fast enough, and whether half the current speed (or 3/4 - at 12 MHz) is fast enough for your application you just have to try. The 8 MHz is dead easy: just set your processor to use the 8 MHz internal oscillator (set the fuses using the "burn bootloader" option of the IDE), and it'll ignore the connected crystal.
By the way, that's a pretty cool wheelchair. I just can't help to wonder: what happened to the chair part? I also watched that 3D demo. I've tinkered a bit with Blender myself, but no idea how you pull that off. Pretty neat.
wvmarle:
yFor the ATmega no problem, for the sensor maybe a problem, check the data sheet. If it can handle 4.2-4.3V that may be the way to go.
Max voltage for sensor is 3.6
wvmarle:
As you have a charger connected as well, this may cause problems as the charger must supply a higher voltage than the battery voltage to be able to charge it.
The only parts of the circuit connected to the charger are the battery and two LEDs.
wvmarle:
For an ATmega the minimum specified voltage for 16 MHz is 3.78V, so at 3.6V you're overclocking (in spec would be 15 MHz), but I'm not surprised it still works well as it's so little. The specification is a guaranteed minimum; not a hard cut-off. For a one-off, self use project I wouldn't fret about it, if you're going to mass produce it it becomes a different story.
Thank you, I'll do some more research.
wvmarle:
If you use a 12 MHz crystal you need 3.06V, that's well below the cut-off of the LiPo battery.
That's good to know, thank you.
wvmarle:
By the way, that's a pretty cool wheelchair. I just can't help to wonder: what happened to the chair part?
The video just showed an RC prototype. The actual finished product would look like this: