Notifications
Clear all

Need help with first project.

74 Posts
4 Users
41 Likes
1,347 Views
Inst-Tech
(@inst-tech)
Member
Joined: 2 years ago
Posts: 554
 

@zander  Hi Ron,

To answer your questions...ie "So my question is why didn't you use a 1Kg sensor which would be far more accurate with the 500mg weight in the middle of its range instead of at 5% of the range of the 10Kg sensor?"

The 10kg sensor was purchased because I could use it to later projects that involved more mass measurement as 10kg is 22 lbs and was sufficient for what i had in mind.. In metrology, calibration is fundamentally comparing a measurement to some standard that is typically 5-10 time as accurate. Because the load cell (strain gage) is a very linear device, the calibration curve has a best fit that is also very linear, thence the slope ( calibration factor for that sensor will be what ever range within the max range I want to use... As all I had to calibrate it with was a 1kg weight set, I chose to use that to determine the calibration constant.

This is done by getting the the tare or zero base line counts, found by using the scale.read_average() with no weight on the scale, then placing a known mass on the scale, and using the scale.read_average() function again to get those counts.

I my case, For the 1 kg calibration:  the tare counts were 558104, and the mass of 1kg was 663534. To calculate the calibration factor, cal_factor= (weight mass counts - tare counts)/ mass calibration weight.... exam: cal_factor=(663534 - 558104)/1000g = 210.66

when calibrating it to the 500g mass: tare counts were 558208, 500g mass counts were 663534. cal_factor=(663534 - 558208)/500g= 210.65  ...

As you can see, there is vertically no difference because the slope of the calibration line is linear. In instrumentation,  we routinely calibrate sensors to ranges that are far less that the sensors max sensing ability. This is called  the turn down ratio of the device. This is anywhere for 10:1 to 400:1 on some sensors. I find the accuracy is less that +/- 1 gram!  Can't beat that wit a stick...lol

Calibration, and how to perform it correctly, takes years of experience to really understand it..as most instrumentation is not all that linear, but the good news is that in this case it very simple, just follow the examples I have just given you, and you'll be surprised just how accurate those little cheap sensor are.

if you have any more questions, please just ask..

Regards,

LouisR

 

LouisR


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7098
 

@inst-tech I understand the concept, I am just surprised the sensor is so linear. This goes against my 'gut' based on decades of experience but I know you are the expert in this field so I accept what you are saying. Still learning.

I am never going to exceed 100gm on my scale, so I ordered a 100gm sensor. I have a 1 Kg sensor already, maybe I will wire it up and have a look.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
Inst-Tech reacted
ReplyQuote
(@billinfl)
Member
Joined: 3 months ago
Posts: 33
Topic starter  

@davee Dave, Thanks for that info. As well as all suggestions on here! I'll take your items in order. (I was away and just scrubbed back in this morning).Here's what I've confirmed so far.

The small 7 segment displays I bought with 1/2 inch digits didn't come with a data sheet, but what did I expect for a 10-pack for less than a (fancy) coffee? Anyway, I think I'm going to bag the idea of starting with the small ones, since they are a different animal, they are too small for the project and (as you're about to see) you were right!

The 3 inch common anode display I bought (and need to use) did not operate with 5 volts. Once I figured out the pin-out for the thing, which the data sheet had all screwed up,  I connected the display to a 3 pack of D size alkaline batteries with an output of 4.86 volts to simulate the R-4 uno voltage. (I'm not ready to "smoke test" my new uno just yet, so I found some batteries). The segments all stayed dark, except for the decimal point, which just glowed dimly. That's when I realized that you nailed it when you questioned the data sheets voltage info. Plan B was then implemented, which presently has the segments bright enough for my project using a 9 volt battery instead.(9.45 volts avail.) I have measured the current draw by inserting the trusty Fluke in series with the positive side of the 9v battery and all I'm getting is 4 mils per segment at a LED brightness that is enough for me. (this is with using a 470 ohm (per segment) resistor in series with the minus side of the battery). That seems low to me, but that's what the meter says. So, I would think that the overall current draw from the battery when the number "8" is displayed will be 28 mils or so, but I haven't found enough 470's to get all the segments lit at once. (I don't need or want the decimal point). Bottom line, it looks to me like if push comes to shove, a 9 volt wall wart would work out fine for the 3 inch display. 

Trouble is, I'm not sure where to go from here with the R-4 being just 5 volts, with a limit of somewhere between 8 and 20 mils. Back when I had time to tinker with basic electronics projects, (we're talking Woodstock), I only messed around with various relays that could be pulled in when low power was applied to the coil, which would then allow large amounts of juice to get to a device. I realize that that's what I'm trying to do here, but things get complicated (to me) when the uno pin current is that low and the voltage is too low for the LED display. So now I'm ready to go to battle with my "Brick Wall".

You said to ask questions. But for now I only have one, would you recommend that I continue to try and make the uno that I bought work, or should I be asking about and researching a different type of microprocessor altogether? Thanks! 

One more thing for the mix. Wandering around online just a while ago, I stumbled on this driver from SparkFun electronics. The few reviews at the bottom of the page are mixed, but there are a couple using my size display, (the display they sell is overkill for me), so now I'm wondering if it may have any promise for me as a "brick wall breaker". (I tried to post the actual page link here but couldn't figure out how). Please go to spark fun.com and search for "Large Digit Driver". Thanks again. 

  

 

 


   
Inst-Tech reacted
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1721
 

Hi @billinfl,

   Good to hear that you have made some progress ... starting a project with lots of unfamiliar hardware, software, etc. is tough when things are well documented, etc. When you are faced with some minimal scraps of paper, with more errors than facts, it is much, much tougher! So well done for getting this far!

You ask if you are using the right microcontroller board?

I have never seen the particular board you chose. The nearest I have is a clone of the Mega2560, but I have been reading data sheets and encountering microprocessors/controllers for a long time, so with a little Googling, etc. I can take a fair guess of what a UNO R4 WiFi might be like, but of course there will still be some surprises that you can only discover with playing with it.

You have discovered the voltage for driving the LEDs is nearer 9V. You will struggle to find a microcontroller with output pins that can directly cope with that voltage. Most commonly they are 3.3V or 5V, with some newer ones even lower voltage. I hesitate to say that higher voltage chips don't exist, because big volume items like washing machines have sufficient market clout to get 'specials' made, but I don't know personally know of any practical items to recommend.

However, that doesn't mean the project is stuck, just that the microcontroller will need to be supplemented with some driver electronics. Louis @inst-tech has already made one neat suggestion, albeit the chip design might have at least been on the drawing board during the Woodstock festival, if not already on sale. If you can track one down, that will be an easy solution, but not the only possibility.

Basically, almost any microcontroller with some spare input & output pins could probably be persuaded to do the job. My concerns about the UNO R4 WiFi are not that is incapable of the task, but that it is a rather complex board, with lots of features that you might not be familiar with, adding to the complexity, and also a secondary concern that it might have been moderately expensive, so that a mistake (wiring mistake, test probe slip, etc. ... it happens to most of us, from time to time) might result in the higher voltage for the LEDs, necessitating a replacement.

This also depends on whether the final unit is going to be anything more than a widget counter with LED display. e.g. Does it need WiFi and lots of other things the UNO R4 WiFi provides?

If it is just a widget counter, then I would suggest starting with a cheap and simple microcontroller board, leaving the UNO R4 for later study/project where you can make better use of its resources.

As for the electronic 'glue' between the microcontroller and the LEDs, to cope with the higher voltage, I am still looking for the 'neatest' solution for you. Unfortunately, we have never met, so I am concerned about making it too complicated, etc. Plus, I could do with a little time to check a few details.

Perhaps you could tell me a little about your capabilities and thoughts. Are you happy soldering circuits together, reading simple circuit diagrams, etc. Can you obtain parts fairly easily? Is this just a simple weighing widget with a 1 digit display, or is there more to it? Sorry, I don't mean to be intrusive, but I don't want to confuse or patronise you more than I can help.

Best wishes, Dave


   
Inst-Tech reacted
ReplyQuote
Inst-Tech
(@inst-tech)
Member
Joined: 2 years ago
Posts: 554
 

@billinfl , Hi, I was just reading your last post to @davee, and a thought occurred to me about why you are only showing 4mA through one segment..You stated that you were sourcing 9.45 V to the common anode of the LED display, and using a 470 ohm resistor for that segment. Using Ohms law, 470 ohms  x 4mA = 1.88 volts, that means that 7.57v are dropped across that segment.. I believe your data sheet shows 4 led to a segment, so 7.54 v divided by 4 is 1.89V across each led in the segment..for red led's, forward voltage is ~ 1.88 - 2.0V.

This explains why it requires a higher voltage, because the forward voltage drop of each one of them are is series, therefore additive.

You can probable use a resistor of lesser value, say 150 ohms to make it brighter if you need to..or just leave it as is. I strongly recommend using a 7 segment decoder /drive of some sort, like a CD4511b or a Sn74LS47 with what ever micro-control or MPU you want to use.

Hopefully, this will clear up the mystery of why a higher voltage is required to make the display work.

Regards,

LouisR

LouisR


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1721
 

Hi Louis @inst-tech and  @billinfl,

  I agree with Louis' analysis and have been doing a little more digging. For now, just a few random comments.

If you are buying a power supply of some type, I am concerned 9V may not be enough ... it probably is, but it is tight. Your tests do not include the drop across the driver chip. You might want to hold off from purchasing yet, but I can see a reason for slightly higher, maybe 12V.

------------

Also need to watch the voltage going to the TBD microcontroller ... many of the small boards have rather limited input voltage capability.  A small converter is a common fix. But that can wait for another day to discuss properly.

------------

Louis's BCD to 7 segment drivers simplify some decisions, and only use 4 pins to connect.

---------

An alternate approach might use 7 microcontroller outputs, instead of 4, one for each segment, then something like a ULN2003 as the driver chip. (Amazon UK lists them for about US$6 for a pack of 10, though you only need 1, including UK delivery, so hopefully same or cheaper for you. Of course, you may have a cheaper source.) I think you will also need 1 input and 1 output extra microcontroller pins to talk to the HX711.

UK Amazon also lists a clone of Arduino Uno R3 for roughly US$7 delivered. Again, you need to check locally.

If it helps, and you are interested, I could try doing a very rough prototype of the LED side, using bits in my spares box, before you spend your money. Obviously, I can't check the exact bits you are ordering, but it could be a 'sanity' check. Let me know.

It might be helpful if you could measure the voltage across one the LED segments .. as Louis says it is probably around 7.5V.

Also, try a smaller resistor, something like 150 to 220 Ohms would be fine, and repeat the measurements, and note how you like or dislike the brightness. Probably only need to try one segment, and hope the rest are the same!

Best wishes, Dave


   
Inst-Tech reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7098
 

@billinfl I didn't realize the size of the display. AT $30 USD for one digit including driver that will get expensive in a hurry if the display is very big. It requires a 12V supply as well as a 5V. Interesting device though.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
Inst-Tech reacted
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1721
 

Hi Louis @inst-tech and  @billinfl,

  I have just done a very rough prototype of the LED side of this project, with a simple Arduino IDE C++ program that counts slowly from 0 to 9.

I used a 7 segment display, with just 1 diode drop (1.9V) per segment, but for one of the segments, I added 3 blue LEDs in series, so the total voltage drop across that LED chain was about 10V. (I chose blue to make the test a bit more 'severe', ensuring some margin for the large LED.) I used a variable voltage supply, to see what voltage was needed for reliable operation.

To drive the 7 cathode segments, I used a ULN2003 with 7 Darlington Pairs, as mentioned before.

Microcontroller was an ESP32-S3 dev board, which was conveniently available. Note this is a 3.3V chip, so representative of many other chips including ESP8286, any of the ESP32 family, RPI Pico and a few Arduinos.

The wiring from the microcontroller to the ULN2003 is simply from GPIO pins, all used as outputs. (I think the HX711 will need 2 more pins, on input, the other output.)

The test program was essentially just a function that took a number between 0 and 9, and set the seven highs (segment on) and lows (segment off) to give the required digit pattern.

I also included a 'software brightness' capability of switching the 'on' segments, 'off' for a proportion of the time. Most microcontrollers could use a PWM function, but for this demonstration/test I kept to some simple code, using the Arduino delay function.

Conclusions:

As I suspected, the minimum power supply should be 12V, and this could be 15V or more. (The ULN2003 maximums are 50V and 500mA, giving as much flexibility as required. Also, it is available in a 16pin DIP package, for easy soldering.)

Being able to choose a 3.3V microcontroller expands the range, with a lot available at low prices, albeit the lowest prices might mean waiting a few days. 5V Arduino designs with sufficient GPIOs would also have been suitable.

Most small microcontroller boards have a voltage regulator on board, but with minimal heat sinking. Adding a 'pre-regulator' to drop the 12-15V to about 7V (for a 5V microcontroller) or about 5V (for a 3.3V microcontroller) is advised. There are many choices, including some small buck regulators. As with the ULN2003, Amazon, etc. tend to sell them in packs of 5 or more, with cheapest packs being the equivalent of about US $7 in the UK, delivered.

All of the prices discussed are defined more by the handling and delivery, than the inherent cost of making the item. There are very large variations, and the figures quoted were to give an starting indication, not a recommendation.

----------------

I am happy to provide more detail, if requested. This was just a note to give an idea of what might be involved.

Best wishes, Dave


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7098
 

@davee Just curious Dave, but does not the OP have a store bought 3" high 7 segment display? As well he found a driver that is made for larger displays. The driver requires 12V and 5V.

I am sure your findings are accurate, but I suspect it is overkill when the OP has a display already.

OR maybe Ron has lost it again.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1721
 

Hi Ron @zander

I only know what is in the above messages ... and I might have misread them.

So far as I know, he has one 3 inch high, seven segment LED digit, that he wants to use.

He also has a Uno R4 WiFi, but I am not clear why that one was chosen. Clearly, it is not capable of directly driving the chosen 'digit'; some form of current and voltage 'amplification' is required.

The digit came with a 'minimal' data sheet, that I pointed out a major contradiction ... namely that in each segment, the diagram showed 4 LEDS in series, whilst the data sheet suggested just 1 LED per segment.  So far as I can see from his posts, it is basically the same as the 'regular' 7-segment LED digits of about 15 mm height, with two rows of 5 pins for connection, but obviously larger and more power hungry.

Using my 'contradiction warning', together with some alkaline cells and a resistor or two, he managed to find out each segment did have 4 LEDs in series.

I think that is about as far as he got with the display side, albeit he now has a better idea of the voltages and currents needed for the display, and has asked some pertinent questions.

Both I and Louis (@inst-tech) have tried to give him some more insight and also added new questions for him.

Does that make sense?

Best wishes, Dave


   
Inst-Tech reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7098
 

@davee It would make sense if the OP was not going to use the driver he found that is purpose-built for driving large 7 segment LEDs. I have not seen the OP say one way or the other, perhaps you are a mind reader?

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1721
 

Hi Ron @zander,

  Sorry, I haven't seen anything about him finding a driver for the large LED display ... where is that?

Best wishes, Dave


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7098
 

@davee That is why you have to actually read what people post. Here is the reference from a few posts back.

 (I tried to post the actual page link here but couldn't figure out how). Please go to spark fun.com and search for "Large Digit Driver". Thanks again. 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@davee)
Member
Joined: 3 years ago
Posts: 1721
 

Hi Ron @zander & @billinfl,

  Sorry Ron, I did overlook the sentence you have just referred to ...

I'll try to redress the balance by having a quick look at the article and noting my impressions below.

---------

The product page is at https://www.sparkfun.com/products/13279

which is basically the TI chip TPIC6C596 on a board https://www.ti.com/lit/ds/symlink/tpic6c596.pdf

with a surface mount resistor in series with each open drain connection.

The schematic https://cdn.sparkfun.com/datasheets/Widgets/Large%20Digit%20Driver.pdf

shows the resistors to be 20 Ohm, (c.f. the description of the board says "The Large Digit Driver has 8 inline 15 Ohm resistors to limit the current through each segment on the 6" display to 20mA"). This resistor value is very low, expecting a resistor voltage drop of only 0.4 V.

This means that the supplied voltage must be critically aligned to the forward voltage drop of the LEDs, for the expected current, because a small change of supply voltage, or of the voltage drop of the LEDs due to temperature, etc. will make a large change in the current flow, which in my opinion, is a situation that is generally to be avoided.

----------

Connecting the board with the 3.5" display and 12V as described by Sparkfun would have almost certainly destroyed the display.

The LED voltage drop for the 3.5V display is around 7.5V, not around 11.5V of the Sparkfun 6.5" display digit. This could be fixed by changing the surface mount resistors to a more suitable value. 

I would guess the Sparkfun board would be more expensive, but this depends upon local circumstances.

It uses a shift register, which reduces the number of GPIO pins required, compared to the suggestions from either Louis @inst-tech or myself.

----------

On the basis of my comments above and my impression of the requirements, compared to the suggestions by Louis and myself, I would not have recommended it in this case.

If minimising the number of microcontroller pins required is paramount, then it offers an advantage. However, there are alternatives with similar interfaces.

My suggestion was based on keeping to a simple approach. Shift registers are fine if the system (hardware and software) has no errors, or the instigator has test gear and experience. But diagnosing faults by chat messaging can be hard.

However, if @billinfl wishes to use this device, then providing the resistors are changed (or additional ones added in series), then it appears to be a feasible approach.

-----

I hope that is clear and helpful. Once again, apologies for my oversight, and thanks to Ron for spotting it.

Best wishes, Dave


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7098
 

@davee Great news Dave, I have been in touch with TI and they are willing to hire you to replace the team of engineers who did such a lousy job of designing that product. Of course this means not just moving to the USA, but to Texas of all places.

Since they will obviously need to reimburse all the less intelligent people that purchased this defective (according to Dave) product, they are wondering if you could write up that explanation in a way that can be included with the reimbursement cheques?

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Page 3 / 5