OpenMarine

Full Version: Sensor board & python help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hi Gang,   
the story so far - ALready I have a board from jlcpcb with headers for ads1115 & other sensors working well, so it turns out jlcpcb has sensors available as surface mount which they will generously solder for you in exchange for a little cash  Cool
 
So this weeks plan is something like the circuit below - 2 x ADS1115 voltage sensor, an INA219 current sensor for up to 3.2A and a 20A ACS712 current sensor. Plus an input for engine RPM taken from the alternator, 2 x NMEA018s in/outs , bme280 barometer and some header pins to break out I2C & ds18b20 thermometers/DAC output header(for controlling a FET to get constant current battery draw, handy for capacity testing).  
Then the overall plan is to have the BOM, pick & place files etc plus micropython files all on github - so anyone else should be able to burn the files onto an ESP32, order the boards and they should work, sending data as signalk to openplotter......

So questions - any obvious errors in the circuit below? (work in progress, must be some errors in there)  Or additions? Most of this has been working already & I'm slowly converting the arduino code into micropython. Or any additions? Will prob add some GPIO in/outs to header pins & some FETs as low current 12v switches. 

Also - loads of tutorials for python commands and modules, but nothing much coming up about more general python programming tips and tricks and best practice to structure a program, how often & where to put  try,except - and links to something for general python programming tips?  

But looking OK so far, micropython seems stable enough and *much* easier to read a week later and still see what you did Smile

Thonny editor works OK with  few little bugs, uploads files fast straight to the esp32. 

Might be a good way to share code, the arduino IDE can sometimes be tricky to make sure the library is one that works for sure rather than a new one. 

TIA  Heart

[Image: ZPu3NwL.png]
Awesome PaddyB!

Are you planning to put this up on GitHub or something like that? I'd really like to see some of the code just as a learning experience for me. I don't know what you are using for an IDE, but I can recommend PlatformIO - at least it works for me with C++ programming and it apparently works well with python also (it was written in Python). It also makes GitHub very simple.
(2019-12-17, 01:41 PM)abarrow Wrote: [ -> ]Awesome PaddyB!

Are you planning to put this up on GitHub or something like that? I'd really like to see some of the code just as a learning experience for me. I don't know what you are using for an IDE, but I can recommend PlatformIO - at least it works for me with C++ programming and it apparently works well with python also (it was written in Python). It also makes GitHub very simple.

Plan is hopefully for a 'one stop shop' sort of thing on github, with all the files that are actually known to work rather than linked libraries etc. I've been using VSC for c++ but haven't got it sorted yet to upload micropython files straight to the esp32, must have another hit at it. Thinking thonny might be easier for less geeky types as well though not as comprehensive as VSC. 

Micropython / JLCPCB could well be a stable way to share all this stuff around, jlcpcb.com are *great*!!! Free surface mount til Xmas!  Cool
How about allowing for connecting INA219 to an external, high current shunt?

Otherwise looks very interesting!


Sent from my iPhone using Tapatalk
(2019-12-17, 04:59 PM)tkurki Wrote: [ -> ]How about allowing for connecting INA219 to an external, high current shunt?

Otherwise looks very interesting!


Sent from my iPhone using Tapatalk

Done that already with a previous incarnation, works a treat Cool Seemed to be accurate down to about 100mA on think it's a 200A 50mV shunt. Even with the little shunt resistor still connected to the INA219. But good call Idea , would be handy to have a couple of pads so the 0.1Ohm resistor could be easily disconnected.
I like the way the schematic is divided into blocks.

U1_INA219, SDA goes to SCL and SCL goes to SDA.  Intentional?


Quote:jlcpcb.com are *great*!!!

Indeed.  I spent eight years running a business selling PCBs, mostly from JLC (I speak Chinese and lived in Shenzhen for several years).  Can't do that business any more, but it's us the designers who win!

  https://www.sz-jlc.com/
(2019-12-17, 11:14 PM)CapnKernel Wrote: [ -> ]I like the way the schematic is divided into blocks.

U1_INA219, SDA goes to SCL and SCL goes to SDA.  Intentional?

Well spotted!!! Thanks, sorted now.  Cool
Boards arrive..... But the day after I left the country I had them sent to so still can't have a play.... Like Xmas never happened Smile

But had a thought about the board - why not add a header so it could plug straight on to the Pi? Then anyone who can solder a few header pins could have a 'hat with many sensors' probably cheaper than getting the sensors off ebay Cool




[Image: ZPu3NwL.png]
Good idea, or at least a header that can accept a ribbon cable that can plug into a PI. Of course then you'll need to line up mounting holes, Then there's the power to the PI.

Then, of course, the mSATA connector, the safe power/shutdown switch, the USB hub, SEATALK bridge ..... ;-)

(Great job, by the way).
(2020-01-07, 01:32 PM)abarrow Wrote: [ -> ]Good idea, or at least a header that can accept a ribbon cable that can plug into a PI. Of course then you'll need to line up mounting holes, Then there's the power to the PI.

Then, of course, the mSATA connector, the safe power/shutdown switch, the USB hub, SEATALK bridge ..... ;-)

(Great job, by the way).

Just needs a bit of time to draw Cool Well, connections anyway. Seatalk bridge is a bridge too far so far for me though haven't played yet, apparently 9 bit so  arduinos apparently can talk seatalk but ESP not. Though JLCPCB do the atmega chip surface mount so should be possible.. 
https://jlcpcb.com/client/index.html#/pa...ATmega328P

How cool would that be!! Cool
Pages: 1 2 3