Author Topic: Small Lab (SLab) release  (Read 2664 times)

0 Members and 1 Guest are viewing this topic.

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 4682
  • Country: us
Re: Small Lab (SLab) release
« Reply #25 on: February 19, 2018, 05:49:44 am »
I know that it is good to be paranoid when dealing with protection, but those kinds of potential problems are always present when you deal with MCU demonstration boards.

I can't get past the feeling that this isolation thing is like chasing something down a rathole.  Without building a custom PCB for the entire project and using an external programmer (while not connected to a DUT, of course), it just gets ridiculously complex.

Breaking off the programmer?  Well, there goes that feature!  Popping off a diode?  Sure hope I remember when I repurpose the board.  USB isolator of limited ampacity?  That sure puts a crimp in things, 30 mA isn't much.

How about this solution:  Don't use any source of external power with the tool and be very careful where the scope ground lead is connected if at all.

Seriously, this is getting out of hand.  A powered USB hub will solve all of this other than spiking the USB data lines and, even then, it will probably only trash the hub.  There is a risk with any kind of USB tool.  Perhaps we should just use the tools with disposable PCs.  We all have some (or several)...  I have 3 laptops and at least one workstation I don't care about.

Hey the host is just Python, why not run the setup on a Raspberry Pi?  Trash the Pi, buy another one.  This might be the solution I arrive at.  I have a few Pi's laying around and I doubt I would miss one.  I can use a KVM switch on my 27" monitor and call it a day.


 

Offline Vic20

  • Contributor
  • Posts: 46
  • Country: es
    • R6500
Re: Small Lab (SLab) release
« Reply #26 on: February 19, 2018, 06:54:47 am »
Quote
I can't get past the feeling that this isolation thing is like chasing something down a rathole.  Without building a custom PCB for the entire project and using an external programmer (while not connected to a DUT, of course), it just gets ridiculously complex.

Yes, when you enter in the security game, things can get as complex as you want.
Isolating the data path between the PC and the board, for instance, by using an optocoupled RS-232 connection secures the PC.
In this case, it is best to isolate the USB connection to maintain the debug path that programs the MCU.
If you want to secure the board itself then it comes down to resistors, diodes, MOVs and spark gaps. Like in a multimeter input stage.

Quote
Breaking off the programmer?  Well, there goes that feature!  Popping off a diode?  Sure hope I remember when I repurpose the board.  USB isolator of limited ampacity?  That sure puts a crimp in things, 30 mA isn't much.

Breaking the Nucleo board is no problem at 9 or 10€ each.

Quote
How about this solution:  Don't use any source of external power with the tool and be very careful where the scope ground lead is connected if at all.

This is a solution.
The initial idea of the SLab project was to power everything from the board itself. If you don't make any connection to other power sources, most potential problems are much reduced.

Another solution is to use an external power supply and make all connection in the signal path trough resistors. You can also include some MOVs, diodes and/or zenners if you like to keep the voltage between bounds.
I have tested the microchip Opamps I use with 100k resistor protections and the handle with no problems 20V input voltages when they are powered at 3V. The microamps current they get in the input protection circuits seems to not give any problem.

Quote
Seriously, this is getting out of hand.  A powered USB hub will solve all of this other than spiking the USB data lines and, even then, it will probably only trash the hub.  There is a risk with any kind of USB tool.  Perhaps we should just use the tools with disposable PCs.  We all have some (or several)...  I have 3 laptops and at least one workstation I don't care about.

Well, I work with students that use ST Discovery boards and Arduinos connected to the PCs. We have also power supplies so there is always the option to do very bad connections.
Students do all kinds of things you never thought they would do.  There are some boards damaged but no PC damaged at all.
It is much more common for students to blow the 50 Ohm input on the function generators.

Quote
Hey the host is just Python, why not run the setup on a Raspberry Pi?  Trash the Pi, buy another one.  This might be the solution I arrive at.  I have a few Pi's laying around and I doubt I would miss one.  I can use a KVM switch on my 27" monitor and call it a day.

I don't think I will do that.
In my case, I will add some resistors and perhaps some additional protection components.
That's enoug for my needs.

As I understand, the problem related to this thread is not that I blow anything or that YOU blow anything but that someone can take my schematics and, as the SLab project is targeted to newbies, do something really stupid and blow its own PC.

Although this is the same problem with arduinos that are also targeting newbies, I plan to, at least, to give some warnings and add some protection in the schematics.
Tomorrow I will test the impact on signal integrity of adding some protection resistors. I suspect that range of frequencies I use is so low that it would be no problem.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 4682
  • Country: us
Re: Small Lab (SLab) release
« Reply #27 on: February 19, 2018, 07:04:18 am »
One little 'gotcha':  If the Nucleo is powered from E5V or Vin, the USB enumeration may not happen properly.  To get the enumeration right, you have to plug the USB cable in AFTER the board is powered up.  I'll bet that's what the MOSFET is doing in the USB incoming 5V.

In the bigger scheme of things, this could be a real PITA!

See page 21 here:

http://www.st.com/content/ccc/resource/technical/document/user_manual/98/2e/fa/4b/e0/82/43/b7/DM00105823.pdf/files/DM00105823.pdf/jcr:content/translations/en.DM00105823.pdf

See Note 3 on Page 55

If it works, the Raspberry Pi idea is looking better and better.
 

Offline Vic20

  • Contributor
  • Posts: 46
  • Country: es
    • R6500
Re: Small Lab (SLab) release
« Reply #28 on: February 19, 2018, 07:16:24 am »
One little 'gotcha':  If the Nucleo is powered from E5V or Vin, the USB enumeration may not happen properly.  To get the enumeration right, you have to plug the USB cable in AFTER the board is powered up.  I'll bet that's what the MOSFET is doing in the USB incoming 5V.

In the bigger scheme of things, this could be a real PITA!

Yes, I have read that on the Nucleo manual.
But it is not a problem for me to first power the board using E5V or Vin and connect the USB line afterwards.
And yes the mosfet T2 is just for that, to connect U5V to 5V is enumeration succeeds.
In either case, the problem is only important if you use an external supply because you need more than 300mA or if the PC is not able to provide 300mA.
If you use low current levels and the PC enumeration usually goes well, there is no such problem with the power order.
If you don't like enumeration you can always bridge the mosfet M2 by adding solder bridge SB1 (see page 26).
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 4682
  • Country: us
Re: Small Lab (SLab) release
« Reply #29 on: February 19, 2018, 07:29:15 am »
I have decided that Version 1.0 is going to be as drawn.  I'll worry about the isolation stuff another day.
 

Offline AG7CK

  • Regular Contributor
  • *
  • Posts: 90
  • Country: th
Re: Small Lab (SLab) release
« Reply #30 on: February 23, 2018, 10:24:21 am »
Looks nice - especially for people who wants to modify it themselves. I would like to test SLAB, but I have very little knowledge beyond simple Arduino stuff.

1/ I have a http://www.st.com/en/evaluation-tools/nucleo-f446re.html board that I haven't used yet. Can I use that in stead of the http://www.st.com/en/evaluation-tools/nucleo-f303re.html?

2/ I am blank on Python, but have Python 2.7 running on w10:

Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32

Can I keep v.2.7 so that I can use an old HP Compaq running XP or w7 as a dedicated instrument PC?

3/ If I use a Hantek 6022BE USB scope and an external transformer based wall wart as PSU, then I will not have to worry about grounding issues?

4/ My old Compaq XP laptop with metal top seems to have (half) line voltage potential exposed. This seems to be inherited by the scope? Is this a problem for the STM board and shield electronic?

5/ I just bought the hardware box and experiment board for the old obsolete NI ELVIS (it is just a big experiment board, with some electronics inside the box, some connectors and a break out header for an NI DAQ - powered by a transformer based ungrounded PSU).

I do not want to use NI DAQ or Digilent Analog Discovery, but would like to make very simple stuff myself using the DAC/ADC and analog/digital I/O of the STM board. Will most people be able to modify the SLAB STM-code and Python-code for extra analog/digital pins in/out, tables n graphs, stats and math etc. ?

 

Offline Vic20

  • Contributor
  • Posts: 46
  • Country: es
    • R6500
Re: Small Lab (SLab) release
« Reply #31 on: February 23, 2018, 07:55:32 pm »
Looks nice - especially for people who wants to modify it themselves. I would like to test SLAB, but I have very little knowledge beyond simple Arduino stuff.

That's the idea. You can modify it for your own purposes.

Quote
1/ I have a http://www.st.com/en/evaluation-tools/nucleo-f446re.html board that I haven't used yet. Can I use that in stead of the http://www.st.com/en/evaluation-tools/nucleo-f303re.html?

As long as it has 2 ADC channels, 4 DAC channels and is MBED enabled it can be easily used on SLab.
The 446RE complies with all requirements.
The firmware, however, is only currently compiled for the F303RE and L152RE boards.
That means that you need to create a new header file like the one for the L152RE and recompile

https://github.com/R6500/SLab/blob/master/Firmware/Source/Nucleo64-L152RE.h

I could do that myself. Problem is I don't have this board and I don't want to publish a firmware I cannot test myself.
There is a part of the MBED code optimized at low level for the 303RE board. If you use any other board the sampling rate performance will be poorer although it will work. At DC there will be no difference at all.

Quote
2/ I am blank on Python, but have Python 2.7 running on w10:

Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32

Can I keep v.2.7 so that I can use an old HP Compaq running XP or w7 as a dedicated instrument PC?

SLab is based on Python 2.7 so it will be ok.
It requires numpy, matplotlib and pySerial so you need to have this libraries installed.

Quote
3/ If I use a Hantek 6022BE USB scope and an external transformer based wall wart as PSU, then I will not have to worry about grounding issues?

Current SLab implementation has the same grounding as the PC is connected to. The usual requirements for grounded scopes and function generators apply also to SLab.
SLab should be quite safe if you power your circuits only from SLab itself. If that is not the case, you need to do your own verification of the setup safety.

I'm now working in a SLab shield for the F303RE board with galvanic isolation. Stay tuned.

Quote
4/ My old Compaq XP laptop with metal top seems to have (half) line voltage potential exposed. This seems to be inherited by the scope? Is this a problem for the STM board and shield electronic?

Don't really understand what half means in this context.
Basically SLab is connected to the 5V and GND lines of the USB connector so there is currently no galvanic isolation to the PC. If you can use the PC, you can use SLab. Problems could arrise when you want to connect SLab to any other instrument or circuit.

Quote
5/ I just bought the hardware box and experiment board for the old obsolete NI ELVIS (it is just a big experiment board, with some electronics inside the box, some connectors and a break out header for an NI DAQ - powered by a transformer based ungrounded PSU).

I do not want to use NI DAQ or Digilent Analog Discovery, but would like to make very simple stuff myself using the DAC/ADC and analog/digital I/O of the STM board. Will most people be able to modify the SLAB STM-code and Python-code for extra analog/digital pins in/out, tables n graphs, stats and math etc. ?

SLab documentation is Creative Common Attribution-ShareAlike 4.0 International license.
SLab hardware is completely open (Don't know about the Nucleo boards but they are full documented).
SLab software is do whatever you please with no warranties (MIT license alike).

The software is designed and documented so that it is easy to modify for your own purposes.

Modifications on the software depend on what you want to do.

A lot of extensions can be performed just adding Python code.
In order to add new core functionalities, like more than 8 digital I/O lines or high speed  sampled digital capture, the board firmware shall be modified also. I have a plan for some new functionalities, but if you cannot wait and want to modify the code yourself, just do it.

It should be easy because the firmware just responds to commands. New commads can be made nearly independent of previously implemented commands. Although using a similar protocol on new commands will help.




 
The following users thanked this post: AG7CK

Offline janoc

  • Super Contributor
  • ***
  • Posts: 2419
  • Country: fr
Re: Small Lab (SLab) release
« Reply #32 on: February 23, 2018, 09:16:18 pm »
SLab is based on Python 2.7 so it will be ok.
It requires numpy, matplotlib and pySerial so you need to have this libraries installed.

Guys, you do want to update that if you don't have a Python 3 version already:
https://github.com/numpy/numpy/blob/master/doc/neps/dropping-python2.7-proposal.rst

There is no good reason to start a new project with Python 2.7 today, even if your machine doesn't come with Python 3.x out of the box.

I had a quick look through your code and for the most part it is just replacing the print statement with the print() function (which is, btw, possible to use in 2.7 too if you want to maintain compatibility).
 

Offline AG7CK

  • Regular Contributor
  • *
  • Posts: 90
  • Country: th
Re: Small Lab (SLab) release
« Reply #33 on: February 23, 2018, 09:48:47 pm »
Vic20 - Thank you very much.

I have already updated drivers for the 446RE board and compiled a few STM programs found on mbed (including serial stuff that works against Putty). Very slick stuff, mbed.

I am now studying your STM code. I have a little bit experience with C and C++, so I understand quite a lot. I will also try to modify the header for my board.

Concerning the line power from the SMPS I just searched "electric current felt on laptop metal case". It is common for PC metal cases. I don't really know the explanation, but it is not only me - people with the same symptom are all over the internet. I have not killed any Arduinos, PSOCs or Launchpads yet, so I will plan my circuit under test with the STM board as I do with the other boards I have (including sampling up to 15v through resistive dividers 1:5). If I kill anything, I will only blame myself. After all, there cannot be more than using floating supplies, remembering 3.3v limit and current limiting that must be respected. I would suppose that people using Analog Explorer must take the same precautions.

Thanks again. I will report here when I get to compiling your code for the 446RE board and have the necessary libraries for Python to run your PC code.
 

Offline Vic20

  • Contributor
  • Posts: 46
  • Country: es
    • R6500
Re: Small Lab (SLab) release
« Reply #34 on: February 23, 2018, 10:09:22 pm »
Vic20 - Thank you very much.

I have already updated drivers for the 446RE board and compiled a few STM programs found on mbed (including serial stuff that works against Putty). Very slick stuff, mbed.

I am now studying your STM code. I have a little bit experience with C and C++, so I understand quite a lot. I will also try to modify the header for my board.

If you have MBED experience, modifying the board header file should be easy.

Quote
Concerning the line power from the SMPS I just searched "electric current felt on laptop metal case". It is common for PC metal cases. I don't really know the explanation, but it is not only me - people with the same symptom are all over the internet. I have not killed any Arduinos, PSOCs or Launchpads yet, so I will plan my circuit under test with the STM board as I do with the other boards I have (including sampling up to 15v through resistive dividers 1:5). If I kill anything, I will only blame myself. After all, there cannot be more than using floating supplies, remembering 3.3v limit and current limiting that must be respected. I would suppose that people using Analog Explorer must take the same precautions.

Yes, the SLab system is no different of any other uses of the Nucleo boards.

Respect to noticiying electricity on the metal case it can be static discharges or mains coupling. If the laptop uses a power brick it could be isolated from earth ground and mains, so I don't really understand what is happening.
If the Laptop is grounded, it could be static discharges.

Quote
Thanks again. I will report here when I get to compiling your code for the 446RE board and have the necessary libraries for Python to run your PC code.

If you do that, I can upload your firmware contribution in the Github repository.
 

Offline AG7CK

  • Regular Contributor
  • *
  • Posts: 90
  • Country: th
Re: Small Lab (SLab) release
« Reply #35 on: February 23, 2018, 10:24:10 pm »
I have never touched mbed before, but anyone can start using a Nucleo board in 5 (10-30) minutes by watching  the video below. My board hadn't even been opened in the year or so since I bought it - today it runs smoothly with mbed. The procedure in the video might have changed a slightly since 2014, but I had no problems.

My experience in C++ / C is from Arduino / TI Launchpad / PSoC.

I will report back after I have studied and tried to compile your code. Thanks again.

« Last Edit: February 23, 2018, 10:31:42 pm by AG7CK »
 

Offline AG7CK

  • Regular Contributor
  • *
  • Posts: 90
  • Country: th
Re: Small Lab (SLab) release
« Reply #36 on: February 24, 2018, 02:15:22 am »
The C code from https://os.mbed.com/users/vic20/code/SLab_Python/ was just a click to import and compiles now also for platform Nucleo64-F446RE. All I had to do was to turn off the #define FAST_ADC. I am going away for a few days. When I come back, I will compare pins and schematics / datasheets for the F446RE vs. F303RE and study all code for ADC/DAC closer. I have already discovered that I will have to change a DAC pin (DA2) from D13 to A3 (iirc).

I'll be back late next week.

 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 4682
  • Country: us
Re: Small Lab (SLab) release
« Reply #37 on: February 24, 2018, 02:09:22 pm »
Step 1 was to get the board and program it - done
Step 2 was to get Python 2.7 and all the required packages installed - done
Step 3 will be to assemble the board when it gets here Monday

The software seems to work.  I get a couple of plots but it ultimately hangs when it tries to do the transient part of the board test.  Sure, there is no analog stuff!

I bought one of the AdaFruit Arduino Proto Shields but I'm not sure I want to populate it.  I can wait a couple of days.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 4682
  • Country: us
Re: Small Lab (SLab) release
« Reply #38 on: February 26, 2018, 05:20:09 am »
SLab is based on Python 2.7 so it will be ok.
It requires numpy, matplotlib and pySerial so you need to have this libraries installed.

In the readme.txt or any other documentation, it would be helpful to newcomers to detail exactly how to install Python 2.7 (easy to do) but pip may or may not be in the path after installation and new-to-Python users are going to get frustrated.  Especially if they already have Python 3.x on the path.

 

Offline Vic20

  • Contributor
  • Posts: 46
  • Country: es
    • R6500
Re: Small Lab (SLab) release
« Reply #39 on: February 26, 2018, 06:01:08 am »
SLab is based on Python 2.7 so it will be ok.
It requires numpy, matplotlib and pySerial so you need to have this libraries installed.

In the readme.txt or any other documentation, it would be helpful to newcomers to detail exactly how to install Python 2.7 (easy to do) but pip may or may not be in the path after installation and new-to-Python users are going to get frustrated.  Especially if they already have Python 3.x on the path.

That's why I recommend using a full Python installation like Anaconda:

https://www.anaconda.com/download/

I have no tutorial about pip because I don't use it myself.
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 4682
  • Country: us
Re: Small Lab (SLab) release
« Reply #40 on: February 26, 2018, 08:21:38 am »
I dumped Python 2.7 and installed Anaconda2 - that installation is HUGE!
As it turns out, pySerial isn't part of the download so there's a bit of a complication getting conda to add the package.  Conda isn't on the path...

For the IDE, I have been using PyCharm and I think I prefer it over Spyder.  I'll play with Anaconda2 a little more next week when I get the analog board finished.  Visual Studio Code might have some good features - it comes along for the ride.

That high priced USB Isolator ($34) from AdaFruit works well.  It turns out the 2 main chips come up to over $20 (qty 1 at Digikey) so if I toss in a few bucks for the other parts, maybe it isn't so overpriced at that.  Of course, it is a lot more than the Chinese copies.  I could see using the Analog Devices reference designs and building an isolator into some projects.
 

Offline Vic20

  • Contributor
  • Posts: 46
  • Country: es
    • R6500
Re: Small Lab (SLab) release
« Reply #41 on: February 26, 2018, 09:05:23 am »
I dumped Python 2.7 and installed Anaconda2 - that installation is HUGE!
As it turns out, pySerial isn't part of the download so there's a bit of a complication getting conda to add the package.  Conda isn't on the path...

Strange. I think pySerial was in the package. I don't remember having installed it myself.

Quote
For the IDE, I have been using PyCharm and I think I prefer it over Spyder.  I'll play with Anaconda2 a little more next week when I get the analog board finished.  Visual Studio Code might have some good features - it comes along for the ride.

I don't use any IDE. Just an interactive window or files written on nopepad+

Quote
That high priced USB Isolator ($34) from AdaFruit works well.  It turns out the 2 main chips come up to over $20 (qty 1 at Digikey) so if I toss in a few bucks for the other parts, maybe it isn't so overpriced at that.  Of course, it is a lot more than the Chinese copies.  I could see using the Analog Devices reference designs and building an isolator into some projects.

I plan to propose an isolation solution using optocouplers and an FTDI cable USB. It will be cheaper and the cable can be used on other projects.

 

Offline AG7CK

  • Regular Contributor
  • *
  • Posts: 90
  • Country: th
Re: Small Lab (SLab) release
« Reply #42 on: February 28, 2018, 07:36:54 am »
I now have the basic functionality of SLab running on NUCLEO-F446RE in Python 2.7 manually installed by pip etc. A few printouts are attached below.

SLab will be a very useful toolset for me. I highly recommend it as a starting point for (learning) real bench use of Python, and say "Thanks a lot" to Vic20.

Combined with the ability to control SCPI instruments with PyVISA http://literature.cdn.keysight.com/litweb/pdf/5990-9362EN.pdf p.7 - which I have also managed to get running, I can now imagine myself having all tools needed to set up a few old HP Compaq desktops that I have as dedicated test and measurement terminals.

[
Note:

I have not changed the 'main.c', but just prepared for a new board header file

// Information about the board
//#include "Nucleo64-F303RE.h"  // Board 1
//#include "Nucleo32-F303K8.h"  // Board 2
//#include "Nucleo64-L152RE.h"  // Board 3
#include "Nucleo64-F446RE.h"  // Board 4

My unfinished file 'Nucleo64-F446RE.h' is just a copy of 'Nucleo64-F303RE.h' changed a few places:

#define BSTRING  "Nucleo64-F446RE MBED SLab"   
//#define FAST_ADC // Optimized code for single readings

A few more simple changes will probably be needed due to pin differences between the boards.
]


 

Offline AG7CK

  • Regular Contributor
  • *
  • Posts: 90
  • Country: th
Re: Small Lab (SLab) release
« Reply #43 on: February 28, 2018, 07:47:00 am »
I forgot the code ... and the hardware is just a jumper from DAC1=Arduino-A0-pin to ADC1=Arduino-A2-pin. See the SLab header file, documentation and printout.

Code: [Select]
import matplotlib.pyplot as plt

import slab
slab.connect('COM12')
slab.printBoardInfo()
slab.setVoltage(1, 0.33)
print("DAC1 nominal output "+str(0.33))
a1 = slab.readVoltage(1)
print("DAC1 measured by ADC1 "+str(a1))
slab.setVoltage(1, 1.33)
print("DAC1 nominal output "+str(1.33))
a2 = slab.readVoltage(1)
print("DAC1 measured by ADC1 "+str(a2))
slab.setVoltage(1, 2.66)
print("DAC1 nominal output "+str(2.66))
a3 = slab.readVoltage(1)
print("DAC1 measured by ADC1 "+str(a3))

x1, y1 = [0.33, 1.33], [a1, a2]
x2, y2 = [1.33, 2.66], [a2, a3]
x3, y3 = [0, 3], [0, 3]


plt.title('SLab Test (3 points linearity check) : ADC1 vs. DAC1')
plt.xlabel('nominal voltage DAC1')
plt.ylabel('measured voltage ADC1')
plt.plot(x1, y1, x2, y2, x3, y3, marker = 'o')
plt.show()
 

Offline Vic20

  • Contributor
  • Posts: 46
  • Country: es
    • R6500
Re: Small Lab (SLab) release
« Reply #44 on: March 01, 2018, 12:05:45 am »
Guys, you do want to update that if you don't have a Python 3 version already:
https://github.com/numpy/numpy/blob/master/doc/neps/dropping-python2.7-proposal.rst

There is no good reason to start a new project with Python 2.7 today, even if your machine doesn't come with Python 3.x out of the box.

I had a quick look through your code and for the most part it is just replacing the print statement with the print() function (which is, btw, possible to use in 2.7 too if you want to maintain compatibility).

When I started SLab developement I thought about using 3.x
I didn't knew about libraries that I would need in the future so I opted for the most compatible version at the moment
The idea is to make the final version run both on 2.7 and 3.x, but, for now, it is 2.7
I think that some serial code can also be affected a part from the print code
 

Offline Vic20

  • Contributor
  • Posts: 46
  • Country: es
    • R6500
Re: Small Lab (SLab) release
« Reply #45 on: March 01, 2018, 12:11:43 am »
I now have the basic functionality of SLab running on NUCLEO-F446RE in Python 2.7 manually installed by pip etc. A few printouts are attached below.

SLab will be a very useful toolset for me. I highly recommend it as a starting point for (learning) real bench use of Python, and say "Thanks a lot" to Vic20.

Glad that it is usefull for you
When you have a final firmware version for the F446RE board, i can add the files (source and binnary) to the Github proyect in a contribution folder.
 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 2419
  • Country: fr
Re: Small Lab (SLab) release
« Reply #46 on: March 01, 2018, 05:15:25 am »
Guys, you do want to update that if you don't have a Python 3 version already:
https://github.com/numpy/numpy/blob/master/doc/neps/dropping-python2.7-proposal.rst

There is no good reason to start a new project with Python 2.7 today, even if your machine doesn't come with Python 3.x out of the box.

I had a quick look through your code and for the most part it is just replacing the print statement with the print() function (which is, btw, possible to use in 2.7 too if you want to maintain compatibility).

When I started SLab developement I thought about using 3.x
I didn't knew about libraries that I would need in the future so I opted for the most compatible version at the moment
The idea is to make the final version run both on 2.7 and 3.x, but, for now, it is 2.7
I think that some serial code can also be affected a part from the print code

The problem is that the "most compatible version" is 3.x series now, not 2.7 anymore. Unless by "most compatible" you mean "comes preinstalled on a Mac". 3.x series ships pretty much with every modern Linux for a few years now and popular Window distributions, such as Anaconda, ship 3.x by default. Also the default download on Python.org is a 3.x version.

There used to be issues with Python 3 that some libraries that depend on binary plugins (Numpy/Scipy mainly) didn't work or weren't ported to Python 3 yet but that is not the case for several years now. Lot of libraries and tooling doesn't even support 2.7 series anymore because it is too much work to maintain a separate codebase.

For example it would be great to integrate your work with Jupyter (http://jupyter.org/), whether the new Jupyter Lab or the older Notebook so that people can easily work with the measurement in an interface resembling Mathematica or Matlab, including interactive plotting, dynamic controls (buttons, sliders, etc) - but the new JupyterLab doesn't work with old Python 2.7 anymore and Jupyter Notebook is not being developed further for 2.7. ...

I strongly suggest supporting Python 3 - you will need to do it in the future anyway and it is best to do it while the codebase is still small. Porting a large pile of old code is not fun. If you need some help or advice on this front, feel free to PM me, I have quite a bit of Python experience.

 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 4682
  • Country: us
Re: Small Lab (SLab) release
« Reply #47 on: March 01, 2018, 06:25:31 am »
It's alive!  I finally received the PCB only to find out I needed solder paste.  It took a day or so to sort things out.

It seems to pass all the functional tests so now I need to get after the diode and transistor examples.
 

Offline Vic20

  • Contributor
  • Posts: 46
  • Country: es
    • R6500
Re: Small Lab (SLab) release
« Reply #48 on: March 01, 2018, 08:02:38 am »
I strongly suggest supporting Python 3 - you will need to do it in the future anyway and it is best to do it while the codebase is still small. Porting a large pile of old code is not fun. If you need some help or advice on this front, feel free to PM me, I have quite a bit of Python experience.

Don't worry. I will support Python 3. Probably in next SLab version.
The idea is that next version will be compatible with both Python branchs.
I will contact you if needed, but as I only use the SciPy libraries (numpy, matplotlib...) and the pySerial library, I think it will be easy.
 

Offline AG7CK

  • Regular Contributor
  • *
  • Posts: 90
  • Country: th
Re: Small Lab (SLab) release
« Reply #49 on: March 01, 2018, 09:39:44 pm »
@Vic20

I am sorry, but I am am not able to contrinute to the code. I have already done one mistake by thinking that I could use A3 in stead of D13 for DAC2. My mistake came about when I looked at these 2 pinout diagrams, noting that my board had an analog pin 3 while yours did not:

https://os.mbed.com/media/uploads/adustm/nucleo_f303re_arduino_left_2016_7_22.png

https://os.mbed.com/media/uploads/adustm/nucleo_f446re_arduino_left_2016_7_22.png

Then when taking a coser look I realized that the reason you use D13 with the reduced range caused by the led is that all boards only have one analog output A2.

So I will not try to change anything yet. (I have looked at the user guide / data sheet, and things like (Arduino pin) A3 port PB0 ADC12_IN8 (303-board) ADC3_IN12 (446-board) tells me little more than that it is some mux/ADC stuff).

I will now concentrate on my experimental setup and use only ADC1 and DAC1. The most important thing for me in getting your project running is that I am now convinced that I will switch from Basic/Fortran/C/Pascal to Python whenever possible. So thanks again.

It will take me months/years with Python in order to integrate clock, trigger, relays, thermometer, PID controller, 6.5 digit DMM, PSU, precision current source and other devices controlled by RS232, SCPI, non standardized GPIB etc. in my experiment set up.

In addition to your DAC/ADC I will try to get these Arduino/Python based projects running in order to control vintage devices and DIY hardware for experimental physical electronics:

https://github.com/mathiashelsen/agipibi

https://pypi.python.org/pypi/instrumentino

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf