Request: Dragino LoRa Shield for Arduino

Here is a new Arduino R3 variant, which has a shield friendly schematic and no pcb view.

Arduino_uno_Rev3-shield-schematic-no-pcb.fzpz (28.1 KB)

The intent (if not currently due to bugs, the practice) is this: in breadboard the Lora shield above (with the grid size set to 0.01in so the parts will align properly) and dragged over the Arduino connections as it would be in real life, connect the Arduino to the shield:

Note all the Arduino connectors (circled in blue) are green, indicating connections on all pins. That should produce this in schematic (in practice this was produced by connecting all the pins with wires!):

The Arduino on the left connects to the shield on the right (and the Arduino doesn’t appear in pcb, only the shield). Unfortunately we appear to have bugs so the actual schematic from the above breadboard connection looks like this:

The missing wires (circled in red) show up as rats nest lines elsewhere (circled in blue) except for the two grounds which are missing entirely. Attempting to make a connection across the two pins (such as the ground) fails (which it should not.) I will report this as a bug on github and when it gets fixed, this can become the new shield template. For anyone that wants to poke at this here are the two test sketches that created the above images:

Correct-connection-by-wires-Sketch.fzz (64.8 KB)

Incorrect-connections-by-overlay-shield-on-arduino-Sketch.fzz (52.8 KB)

Peter

1 Like

Wow, thank you so much for all your work, Peter!!

Really great :smiley: Will be perfect for my diagrams!

Simone

I’ve been intending to fix up the core Arduino parts for a while and create one that was shield friendly, this was a good excuse :slight_smile: , if I can now get the bugs fixed life should improve!

Peter

@vanepp

Peter you are simply awesome! You do such great work, love how you help others. As I stroll threw, tidying up. I can’t help but notice. A natural leader by example. Excellent work! Thank you very much for all your hard work, we can never say it enough. We can’t do it without good hearted individuals such as yourself. Soooo, thank you again!!

Stay safe! Watch out for the invisible enemy… :upside_down_face: :wink:

1 Like

@vanepp After going over issue parts with grouped pins don’t connect correctly in schematic, doing some research and exploration, I think most of the issue seen here is “works as designed”. Bused connections (pins) are effectively a single wire, and the schematic ratsnest will (and should) only connect one wire from one group to another. That covers the missing GND wires. For the other, visually miss-placed ratsnest wires, the schematic is a logical view, and does not know anything about the physical positioning. It just looks for the shortest way to connect 2 (groups of) pins together. So, with the parts positioned as shown, it is shorter to draw a ratsnest from shield pin “D13” to shield pin “ICSP2 SCK” than from Arduino “SCK” to shield “SCK”. Those are electrically (logically) equivalent wires, because shield pin “SCK” is internally connected (bused) to shield “ICSP2 SCK”. However, that “shortest path” changes based on the position of the parts. Deleting all of the wires on the schematic view, and moving the parts closer together (less than 0.2 in between the ends of the matching pins) moves all of the ratsnest wires to straight Arduino pin to shield pin. Once the short ratsnest wires are replaced by real wires on the schematic, the parts can be moved apart again, and everything (except the multiple GND pins) will be as expected.

shield-schemtic
correct-connections-by-overlay-shield-on-arduino-Sketch.fzz (49.0 KB)

There is still one bug outstanding, and a bit further documented in the referenced issue. That means the parts needed to be moved so that the automatically placed ratsnest wire goes where you want it, then create the real wire for it, then move the parts again to where they are really wanted. Instead of simply ignoring the ratsnest wire, and connecting where you want on the same bus.

Personally, I would change both parts to have a single GND pin at the bottom of the schematic, and wire each of them to a ground symbol, instead of to each other. Same for VIN, 3V3, 5V. Put a single one of each of those at the top of the schematic block, then connect to matching VCC symbols instead of to each other.

I would also leave out any pins on the shield that are not really used. If they are only used to pass signals through to the next stacked shield, they are not needed on the schematic. They have no logical function.

A (functional) block of pins on the Arduino for ICSP makes sense, but there is really no need for 2 of them (on the schematic). Internally the pins are connected together, so one set (without the common GND) would be enough. Also, is the 5V pin for the ICSP internally connected to the (outer row) Arduino 5V? If so, those should be bused, and are not needed in the ICSP block. Probably the ICSP block (group) of pins should only be SCK, MOSI, MISO. Those are the “functional” pins.

I can see the truth in that, but at the same time, you can (should may be another matter though :slight_smile: ) do this in the real world and in my view should be able to in Fritzing too (although being able to do so from a code point of view may be too expensive to consider.)

I agree with that, and normally (with non bused connections to a bused connection such as ground) the same thing happens, the rats nest is in the wrong place but you can “correct” it by manually routing the wire where you want it. With both connections in a bus, you don’t appear to be able to do that (and as noted it may be too expensive code wise to allow it.)

That may end up being what has to happen, due to how the code works (and the work required to change it), but I would rather see if we can fix it reasonable easily. What I’m interested in here is seeing if we can make this simpler for folks new to schematic and/or electronics in general. This same issue came up in the Calliope board that I was fixing up for a group or educators, I proposed a schematic similar to this one where schematic matched breadboard which to me seems easier to understand if you aren’t already familiar with schematics, but in the end they decided schematic was supposed to be more abstract and decided the original way was better (to me it seemed less intuitive, but it was their project.) My aim is usually for maximum laziness, understanding with minimal thinking, and that is what I’m trying to achieve here.

For the shield side, that is fine in some sense (although I’d probably like to know of connections that just pass through as well,) but for the arduino side all the possible connections need to be there so any possible shield configuration can be represented, because we only want one “shield friendly schematic configuration” part not many of them is my thinking.

As far as I can see that isn’t true. The second ICSP connection appears to connect not to the Arduino’s 328 CPU as the first one does, but rather to the USB processor cpu, so for completeness (in case a shield needs to access that ICSP for some reason) the pins need to be at least on the Arduino shield friendly schematic version of the part (although not used in this instance.) As noted I’m trying to make a single “shield friendly” Arduino schematic that will apply to any shield configuration to prevent a part variant explosion (which wasn’t articulated in this post before.)

Peter

You currently can do it, in the breadboard and pcb views. However, schematic view is very much not (does not need to be) real world. It shows logical connections, not physical wires or traces. 2 wires connecting the same 2 points do not make any sense. For a logical connection view.

Currently you cant directly do that. Which is the (real) bug here. You can do it indirectly as shown in the example I included.

Pass through to where? The UNO schematic would still have the (unused by shield) pin, so if something (another shield, or direct connect) was using it, it would (and should) connect there, not to (through) an otherwise unused pin on the shield. Logical view again, not real world.

Sure. But each shield only needs the pins that it uses. The shield schematic graphic can either leave gaps for unused pins, to get the wires straight, or collapse the holes and route the wires a bit.

So ICSP2 pins are NOT tied to ICSP1. Which, yes, means they need to be included separately on the schematic. In fact, that would be an opportunity to do a split part, so that the (logically unrelated) usb serial conversion pins could be moved around on the schematic. Though I did a bug report (Fritzing 0.9.2b I think) about problems using bus and spliting in the same part. (I tried to do a DPDT relay where the schematic switch blocks could be moved to where they were logically used)

That was understood. Shield friendly does not mean that duplicate (bused) Arduino pins have to be included multiple times in the schematic view. The shield(s) only need a single copy of the same pin(s). Tweaking the (shield) pin labeling can show how the shield sees that specific pin (D13 versus SCK). I did say that a separate ICSP (1) block made sense, so for cosmetic reasons, the shield graphic could position that pin where it will align cleanly with either D13 or SCK in the ICSP block. If it using the pin for SPI, align with the ICSP block. If it is using it for general data, align with D13. But probably do not need both of those on the shield. Or either, if the shield is not using that at all.

I’m working on variant UNO and LoRa shield parts to demonstrate what I mean, but I am not as fast at part creation as you are. Not that my version will be “right”. Only showing that there are other ways of looking at and solving the same problem.

@vanepp I finally have a pair of reasonably functional (still incomplete) parts for demonstration. Also for discussion on bugs and limitations. I think that should go into a thread on fritzing-app issues. It is a lot more code related than parts creation. Before starting documentation and categorizing of related bugs though, could you have a close look at the parts? See if I did something wrong/different/non-standard that could be impacting the functionality. And perceived bugs.

I am including a sample sketch setup similar to the earlier sample here, along with separate parts files. The shield is placed over the Uno in breadboard view, connecting the matching pins.

I found an issue with that. It seemed like each time I recreated one one the parts, Fritzing chose a random connection to base the align to grid on. Only rarely could I get the parts to connect when align to grid was turned on. One non-standard thing I have, is blocks of definitions in the fsp file commented out. Things that are not needed yet, but intended either for use later, or for documentation. FritzingCheckPart warns about them (multiple times), but they should be valid for xml.

In schematic view, I added minimal extra power connections and wires. Just enough to get the ratsnest wires to go reasonable directions. pcb view should be standard. Assuming the parts themselves checkout valid, things to discuss are where it should be possible to add a real wire, and where Fritzing shows existing connections. What it highlights when mouse held down on a connection. Which is different in each view. I am seeing some unexpected cases, but want other part builder eyes on the parts before pointing and saying bug.

shield test.fzz (39.7 KB)
arduino_uno_for_shields.fzpz (27.2 KB) dragino_lora_shield.fzpz (9.6 KB)

The parts both look fine to me, the pin numbers are not in sequence (probably from the Uno which uses the eagle2Fritzing numbering which also isn’t in sequence.) I have seen that (usually in parts with schematic subparts) cause errors when hovering over pins but that is about all. I can convert them to in sequence, but the process will ungroup every thing and lose your formatting and comments. Or it can be done manually (but that is painful!) I’d say you are pretty much good to go.

Yep, comments are being mistaken as unrecognized spice data and thus the warnings. I added a filter for comments that just silently discards them.

Peter

@vanepp I created an issue for a code bug from this. If interested, see the details.

The sketch file, and embedded parts, over there are slightly different than here. I found a bug in the shield definition. The ICSP header bus definitions were missing. Getting this fixed may fix all, or only part of the bugs talked about earlier in this thread. As opposed to the working, but not quite as expected/desired. I need to expand my example shield part some more to test out using the headers to switch the LoRa ICSP connections, and getting the manually placed wire were desired instead of where the ratsnest defaults to. The work around of moving the part to get the right ratsnest line first may be all that is needed, but I am suspicious there may be another problem in there. Possibly covered by Fritzing not completely handling the bused connections across views, but maybe not.

I also want to explore options for showing and using the jumper header pins in different views. Considering using internal connector pins in schematic view (inside the body of the part graphics, instead of at the outside edge). Those do not normally go anywhere except to another (physical) pin on the same part, so internal open/closed shorting jumper should work. If I can get a clean way to lay it out.

The existing example should be enough to show what I was talking about earlier in the thread, about an alternate way to layout the schematic view of the parts, using the top and bottom location for power and ground, and only including pins for the shield where the shield electronics actually connects to them. Labels of unused pins (pin location) are optional, but since need to leave a gap anyway, to lineup with the ‘standard’ uno (or other board), I figured they might as well be included. Besides, I built a shield template part in the process of this, and all of the normal uno footprint pins are included in that. Easier to delete unneeded pieces than to add them back in each time.

I

Reading carefully what slack is telling me, I think you have all slack notifications turned off, so, unless you login there occasionally, you have not seen the messages I sent to you there.

That wasn’t intentional! I’ll log on and see if I can correct that :slight_smile: . That may explain why I haven’t seen any activity lately.

edit:

My connection is in such bad shape (around 1% packet loss 100ms - 2 sec ping response to first gateway) that the slack login won’t complete. I expect it times out due to the slow connection. So slack may need to wait for a new network connection …

Peter

I’ll have a look (Internet connection willing) and comment there. Thanks!

Peter

Here is a version of the example sketch with updated parts. I found a way to get the effect I wanted with bused connectors.

Still need to implement the configuration jumper headers the way I want for schematic, but making progress.

bus_connection_working.fzz (38.8 KB)


Here is what should be a fully functional version of the shield friendly uno and Dragiono LoRa parts. Bugs allowing. I did not fill in the shield breadboard graphics beyond what was useful for identifying the functional parts. The focus was on getting the schematic view layout into what (to me) was a more logical structure. Inputs to the shield (the Arduino pins) on the left, power and ground top and bottom, shield specific IO on the right. No duplication of bused connections, no connections on the shield for pins that are never used (directly) by the shield. After some iterations, I found a reasonably clean way of showing the shield configuration / settings jumpers internal to the main schematic symbol block. Both sketch and part files included, so you do not need to extract from the sketch. To get the schematic to work this way, with the LoRa ICSP as a output, I needed to duplicate (and bus) the connections for use with the internal configuration connections.

dragino lora shield.fzz (42.0 KB)
arduino_uno_for_shields.fzpz (27.5 KB)
dragino_lora_shield.fzpz (10.4 KB)

Here is an image of the schematic view with (just) enough real wires to get the rest of the ratsnest wires to go to reasonable locations.

Discussion open for this style of doing the layout.

Since my link is currently up, I have grabbed copies to look over when the link is down and will reply when I can …

Peter

Since the link has staggered up again, here are my initial comments (I’ll drag down the LoRa data to check some details, link willing …):

Issues:

Mod1 (the arduino) shows up in pcb with an outline and label (but label can be hidden so not a big deal.)

Rats nest lines are showing in pcb on the jumpers even though there aren’t connections in breadboard or schematic and they are not correct (they short the two outside jumper positions which is wrong, one or the other should short to center.) Don’t yet know why. This however turned up a bug in FritzingCheckPart.py comment processing as it tries to process the comment. I need to fix that first and see if FritzingCheckPart finds anything. Fixed and now reports no errors, so I don’t know at this point. I’ll poke further.

The factory default jumper positions should be shown with the alternate position indicated somehow (how is currently unclear.)

It is probably preferable to have only one cs connection in schematic so that only one of the options can be used (although the other two will connect if you install wires.) At present you can short D4/D5/D10 by connecting all three jumpers which you can’t (at least easily) in real life.

icsp2 should be on the other side of the arduino to allow a shield to use it if desired as should reset and aref (in order to make the arduino universal and not specific to this particular shield.)

3.3V on the Dragino isn’t connected to 3.3V on the Arduino (there is an internal regulator from 5V on the Dragino I believe, but I need to verify that when my Internet link is up.)

LoRa reset needs a new name to not conflict with Arduido reset as the two are not the same.

I’m not sure what R9-R11 are about, need to look at the dragino schematic I expect. I’m not clear why they have connections although I may have missed a configuration option when doing the origianl.

Selecting one of the other arduinos in Inspector loses the shield entry in the selector and is thus not reversable (probably due to the accepted values being hard coded, which wouid need a code change to fix.) This should be an enhancement request to change the code to export an api that will remove the hard coding of the various options so parts can be added to core and selected in Inspector without a code change required.

The current icsp connection requires the user to know where to connect the ICSP wires, it may be a better bet to do that connection internally in the LoRa shield (without connectors being defined? May not be possible as they are defined in breadboard and pcb)

I’d prefer to find a way to put the pins in all three views as the last iten in the svg with no group so a python script can find and renumber them automatically (with only the requirement to identify connector0pin in the svg.) As it makes creating connectors much less time consuming (the script will properly number and move them if required.) This is more general than just this board.

I’d probably unique the name field by @pin number rather than 1, 2 etc. Probably external pin number (i.e. connector number + 1)

Peter

Here are the references I used.

pin mapping

Lora Shield v1.4 silkscreen

I did not do anything with the Uno PCB view. Due to some other discoveries around the way bus connections currently work (and don’t work), I think the pcb view may need to have the connectors defined, even though logically they serve little purpose. Symptoms say that a connector must exist in the current view before the physical connections specified by the bus are used to determine what is actually connected already. And need to have the shield to host board connections available to get started.

The ratsnest line shorting outside jumpers is actually correct, given that the uno has bus entries tieing the ICSP1 headers with D11, D12, D13. With that, it does not really matter which side the jumpers are configured to. D13 is the same as ICSP1 SCK. The Uno board has them tied together. I assume that some other Arduino board has them separated (or different), or there would be no purpose in the jumpers on the shield. The sample sketch I provided shows that on the schematic view. The explicit wires I added for the ICSP1 pins to the schematic view hide the same symptom there. Delete the explicit wire to ICSP1 SCK, and a ratsnest shows up shorting between the ICSP1 SCK and D13 connections internal to the shield. The shortest wire to make the connection.

Actually you can (in real life). Those are the R9, R10, R11 SMD resistor in the breadboard view. It is quite possible to physically install them all. Not a good plan generally. But the schematic mirrors what I understand of the physical shield properties.

That was a deliberate choice. Maybe incorrect. I did not expect many shields to use the ICSP2 header. Or the AREF and reset pins. A shield can still use that, but the schematic wires would need routing, instead of the straight accross lines for the standard shield pin connections. A trade off, to keep the schematic layout simpler for what I expected to be the usual case.

Are you saying that that the 3V3 pin on the shield, which obviously connects to the 3V3 pin on the Uno, is not actually connected internally on the shield? If so, I need to treat that like the other unused (eg analog) Uno pins. A label, but no connection pin. My assumption from the reading, was that the shield uses either the 5V or 3V3 power source from the uno (host board), based on what is at IOREF.

There is no other reset line on the shield. Yes that is a reset for the shield itself, but with no Arduino board reset shown on the schematic view (of the shield), there should not be a conflict. Like the analog, and some other pins, those are not shown as getting to the shield. They are (assumed to be) pass through, with no connection to the shield electronics. It is not really possible to have totally unique names for every part. In this case, the LoRa SCK, MISO, MOSI are more of a concern. Those exist twice on the shield. Once as connections to the Arduino board, and again for the LoRa internal connection. I did put the big bar and “Arduino” label on the left, bracketing all of the pins (except power and ground) that connect directly to the ‘host’ board.

As above, R9-11, are the 0 ohm jumpers from D4,D4,D10 to CS.

I suspect it is not the hard-coding. My guess is that inspector does not look for substitution parts in the temp bin. I’d say it is a bug, not enhancement, if that is the reason it is not shown. A partial test for that scenario, would be 2 different fzpz parts, with the same family, different types, plus other not matching property names, in a single sketch. See if inspector can toggle between them.

My quick test here found a different bug. After swapping to a different uno, “undo” brought back the previous part, but lost the schematic connection between the 3.3V power symbol and the Arduino. Although it did keep the ratsnest from 3.3V to the shield.

A mouse down on the ICSP1 pins shows where they are connected. And the ratsnest starts between the shield internal ICSP1 and data pins. That is the shortest connection for it to draw. Delete the wires I placed to the ICSP1 shield pins to see that. A different Arduino board, with separate data and ICSP1 pins, would have extra pins to match ICSP1 on the shield. That is, if they were really separate, not just going to different data pins.

The pins need to be at least in the correct layer group. They also need to be at the correct coordinates for the view, so the user/designer needs to have already correctly linked them (by id) to the fzp connector definitions. With that much in place, a script should be able to renumber them without needing them at the end of the svg file, or outside of other groups. I did something similar manually with my text editor. It has the capability to do global edits across multiple files. Just need to specify the substitutions carefully, so that changing “connector1” to “connector22” does not also change “connector11” to “connector221”, and that the target of a change does not already exist, where it would end up getting caught in the next change during renumbering. I handle the 2nd problem by doing things in 2 steps: First change all of the “connector(n)” entries to “konnector(n)”, then the individual “konnector(n)” to “connector(new n)”. That way there is never an overlap during the renames. For the first case, make sure that an entry being changed never has a digit after the part that matched. Depending on the context, including the trailing quote character or “pin”, “terminal”, “pad”, “leg” in the search covers it, but may need 3 or 4 substitutions to do a single renumber. Scripts can use a bit more complex (regex) patterns to do it all at once.

Which leads to a different question … what is a reasonable / standard pin number sequence for a module/board like an arduino? Most discrete components have a well defined sequence, but the layout of the pins on an Arduino do not have an obvious progression order. Each header has pin numbers starting at zero, as defined for that block. But I know of no consistent way to sequence between the headers. Plus some of those headers block numbers run in opposite directions (I think A0 and VIN are both pin 0 in those headers).

A code enhancement might avoid the issue, for this context. The number suffix is only being used to keep the name unique internally. The user typically does not care. Have the code truncate that uniqueness suffix before displaying the name. Just do not display anything after the marker (“@” here). So GND@n just shows as GND, which is all that is normally needed. If more is important for a specific case, the descriptions can be different, or use GND_n instead.

As is, using that external pin number for the suffix would have simplified what I did. I had to keep back tracking, to see what number I should use. A trick I added for some places, was to add the suffix only for the 2nd and later cases. The first / main case was unique, because it was the only one without the suffix. A user invisible suffix would mean that it could always be added, without concern about whether it is needed, or what the users would understand it to mean.

Of course, having the name not NEED to be unique would also fix this just fine. With the id being unique, I see no real (functional) reason that the name also needs to be.

I found a solution to the issues I was having with bused connectors. The hybrid connectors section of the part file format information on the wiki has been updated. Now, going back and cleaning these parts up is on my todo list. Still can not totally hide parts in pcb view, but that is a minor quibble.

I opened an issue for rejecting connections in the SCH view when having part-to-part connections in the BB view. That is the issue in the Incorrect-connections-by-overlay-shield-on-arduino-Sketch.fzz (52.8 KB)