#74 Web Enable your Arduino (ENC28J60 or W5100 Ethernet Controller)

  Рет қаралды 27,999

Ralph S Bacon

Ralph S Bacon

Күн бұрын

New! ralphbacon.blog
It's easy to fit an Ethernet Controller module to your Arduino board that will let you serve a web-page to your browser or smartphone - as well as send you an email to alert you to potential issues.
Using the simple, four-wire SPI communications protocol it's easy to wire up an ENC28J60 to any Arduino UNO, Nano or Mega - and if you use the W5100 board there's no wiring to be done! What could be simpler than that?
It's one thing to wire up an Ethernet Controller, but how do you write the HTML to create a (simple) web page? I show you how, and how we save valuable run-time SRAM. It's not complicated and if you download the fully documented example sketch it will be very obvious how it hangs together.
In the next part we'll cover the (even simpler) process to send an email, and then we'll tie everything together into one project. This is going to monitor my attic water temperature and water level and will alert me if either is too low (no burst pipes for me!).
The example sketch is available below, together with links to the UIPEthernet library I use and other information you may find useful.
GitHub link for sketch (supersedes other links here)
www.dropbox.co...
Demo sketch, UIPEthernet Library, Connection Diagram...
github.com/Ral...
Github UIPEthernet library (most recent)
github.com/UIP...
In depth PROGMEM guide by Nick Gammon (from Arduino.cc forum)
www.gammon.com....
If you like this video please give it a thumbs up, share it and if you're not already subscribed please do so :)
My channel is here:
------------------------------------------------------------------
/ ralphbacon
------------------------------------------------------------------
How can I remember this? Memory tip: "See" Ralph Bacon, geddit?

Пікірлер: 104
@Arciiix
@Arciiix 5 жыл бұрын
I've serached for a good tutorial, and i found! Thanks
@RalphBacon
@RalphBacon 5 жыл бұрын
You're most welcome, Artur, glad you like it. Thanks for posting.
@Ed19601
@Ed19601 7 жыл бұрын
Very instructive. I may have missed it yr video (distracting kids) but the ENC28J60 is rather memory hungry, much more than the W5100. If you use the UIPEthernet library *that basically mimics the W5100 on an ENC28J60, even more memory is taken. I have several enc28j60's from the time they were substantially cheaper, as well as a W5100 shield but now if I needed to buy one I would solely go for a W5100 module (abt 4.5 USD) (if not using an ESP ofcourse), simply because of the memory. oddly it is the ESP8266 that got me to finally have a use for my 'old' ethernet shields. Sure, I have had the odd webpage and switch light on via internet applications on there, but only after getting into MQTT with the ESP I suddenly realized that an UNO with ethernetshield or that old pro mini with ethernet module would do great as a Lora Gateway or just as a sensor node not too far from my router
@RalphBacon
@RalphBacon 7 жыл бұрын
Hey Ed19601, welcome! Indeed, memory usage is a concern: in my current demo sketch it's using 26K just to display a simple web-page (and that doesn't include all the PROGMEM HTML code either). I don't know whether the W5100 is any more or less memory hungry, I think the code required to do all that Ethernet comms is just, well, heavy. If things got too bad (ie the sketch could no longer fit, then an Arduino MEGA would rise to the occasion. I too have several ESP8266 modules and boards (WEMOS D1, Espduino) and if you think memory was an issue in your UNO, well the simple BLINK program takes about 250K - luckily the ESP boards have 4Mb on board so I feel safe! I hope to do videos on these too in the future. The ESP boards can totally replace an Arduino Uno or Nano with the caveat that they only have a single analog pin (how shortsighted that design decision was!). It's great the way you have 'repurposed' your old kit, I'm definitely moving towards web as a means of getting data (as web apps are my day job I know that bit pretty well). If only I had a bit more time. Can I propose a 30 hour day, anyone? Anyone? Thanks for posting Ed, good to hear from you and your experiences of the ENC28J60 vs the W5100. Good to get another perspective.
@Ed19601
@Ed19601 7 жыл бұрын
Ralph, thanks. ENC28 as I understand has to build its own stack, which requires some space. I can only say that the same sketch w. e.g. UIPEthernet lib on ENC28 used 50% more mem than that sketch with W5100 Ethernet lib. Anyway, both don't really leave much room. But if you are not serving a webpage/not use much strings, still able to do a lot with the enc28J60. Great video. Great techniques explained. Loved your library video as well
@robertpoynton9923
@robertpoynton9923 5 жыл бұрын
This is what I've been looking for! I want to use Ethernet to connect my smart switches to home assistant or open hab so that I don't have to rely on WiFi. Now to work out what I need to do this over mqtt.
@RalphBacon
@RalphBacon 5 жыл бұрын
Glad this helped, Robert, good luck with your project (and MQTT).
@dominikgyarmati8757
@dominikgyarmati8757 5 жыл бұрын
Hey Ralph great Tutorial, i had some interesting Problems setting the website up. Took me like 5 hours to fix it. Problem was infact that the buffer was waay too low. Make sure to make the buffer bigger
@RalphBacon
@RalphBacon 5 жыл бұрын
Oh, that's a shame, Dominik, sorry you had such trouble (obviously it worked for me, but why it did for me and didn't for you is one of the mysteries of the electronics and coding universe). I'll review my code and see what I did. Thanks for the heads up.
@brianh9105
@brianh9105 4 жыл бұрын
@@RalphBacon I ran into the same problem too. The HTML line_18[] where the "Clear min/max levels" appear is just over 100 bytes which is the size of your temporary buffer. I changed it to 108 and that fixed the crashing that I was having
@roberteliassen5020
@roberteliassen5020 7 жыл бұрын
Sorry for nitpicking on an otherwise brilliant video. At 14:28 you say "any six hexadecimal". That's not entirely true. You have to avoid some of them. Don't use all 0xff because that would be the broadcast address and would make a switch acting as a hub (if it were to follow the RFC). There are also some multicast addresses which you should avoid. If you start with 74:69:69 and add three more numbers, you should be safe. Great video, thanks!
@RalphBacon
@RalphBacon 7 жыл бұрын
Nit-pick away, Robert. I wasn't going to mention any of this (nor the fact the the first 3 numbers are usually bought by [and henceforth assigned to] a manufacturer either, no-one is going to start building these things into projects with fixed numbers). But I leave out such information just to see who is paying attention! You passed, needless to say! Glad you liked the video, thanks for the additional information :)
@thepvporg
@thepvporg 6 жыл бұрын
There is nothing wrong in cloning the MAC ID of your router as thats how the routers often connect to the modem by cloning the MAC ID of the modem in the router, essentially making the router and modem seem as one device. So for a real world test, using the MAC ID of a device you already own but have got turned off, you can test the device and its ability to pretend to be something it is not... Interesting POC experiment there, can you make it appear to be a mobile device on a network and not be that device, only its MAC ID???
@r3tr0nic
@r3tr0nic 2 жыл бұрын
It is so awesome how inexpensive these ethernet modules are. Well, the WIFI ones are inexpensive too. Really awesome for adding some remote monitoring and control to just about anything. As for numbers, I've always known it to be hundreds, thousands, millions, billions, trillions. In electronics, hundreds, kilo, mega, giga, tera.
@RalphBacon
@RalphBacon 2 жыл бұрын
Totally agree!
@boblewis5558
@boblewis5558 6 жыл бұрын
Ralph depending on where your web page is hosted and whether it's accessible from outside your network you could always use If This Then That (IfTTT) to "push" alerts of various types.
@RalphBacon
@RalphBacon 5 жыл бұрын
Yes, indeed, that is another way to communicate outside of the internal network, thanks for reminding us. I might use this in my workshop automation project.
@MrJamesbowen
@MrJamesbowen 7 жыл бұрын
Place inside to refresh page after 5 seconds:
@RalphBacon
@RalphBacon 7 жыл бұрын
Yes, a neat way of refreshing page although my intention was just to run some refreshes as a 'soak test' for the code; I don't think I was expecting an auto-refresh of the page but now you've said this, I'm thinking "Perfect!". So I may well include that into my final sketch code (if I can ever get an NTP UDP response back using the ENC28J60 unit grrr!). Thanks for the easy-to-implement suggestion, others will get to see that too!
@jyvben1520
@jyvben1520 2 жыл бұрын
4:20 "depends on what sensors you are plugging in", nope, i expect most modern sensors only do centigrade output, Fahrenheit is done in software.
@RalphBacon
@RalphBacon 2 жыл бұрын
What about the LM34, Jyv? That's a precision _Fahrenheit_ temperature sensor! Doubtless for our American cousins who are flummoxed by Centigrade. 😲😊
@MrJamesbowen
@MrJamesbowen 7 жыл бұрын
I'm amazed that is cost NZD5.17 for a Ethernet Shield W5100 and only NZD4.81 for ESP8266 Development Board. It's understand why Arduino development on ESP8266 is becoming so popular.
@RalphBacon
@RalphBacon 7 жыл бұрын
Hi Jimbob, is that cheap or expensive in NZD terms? In UK pounds (well, it always goes back to USD) I find them them both "reasonable" in price and they both have pros and cons. It's very easy to use a W5100 shield (as I demo in my next video too) but wiring up any SPI Ethernet module (like the ENC28J60 Ethernet module) is pretty trivial. The ESP8266 is easy to use too, whether as a module connected to an Arduino, or as a standalone board that *replaces* an Arduino. I'll be covering the ESP8266 variants in a future video...
@boblewis5558
@boblewis5558 6 жыл бұрын
James Bowen if your connectivity requirements do not have security implications for your property you're right, ESP8266 and ESP32 modules are a better substitute. But hard wired Ethernet means far simpler higher security than WiFi that today can be hacked and cracked very easily compared to the past. Similar if not the same problem for any wirelessly broadcast data e.g. Bluetooth or 433MHz transceivers and the like. Personally cat6 is my preferred solution with its FAR higher bandwidth (10Gps now) simply not attainable with WiFi and it's much greater inbuilt security - someone would need extended physical access to get into my home network.
@MPElectronique
@MPElectronique 5 жыл бұрын
ENC28J60 needs higher current than 3.3v output of arduino uno, so you will have to connect an external power supply of 3.3v Thanks. Marc.
@RalphBacon
@RalphBacon 5 жыл бұрын
That makes good sense, thanks for the heads up, Marc.
@bobsort
@bobsort 4 жыл бұрын
Adding to your html code should fix resizing the page.
@RalphBacon
@RalphBacon 4 жыл бұрын
Thanks for that suggestion, I'll try it next time.
@bobsort
@bobsort 4 жыл бұрын
Glad you are back, hope you are feeling better
@thepvporg
@thepvporg 6 жыл бұрын
So why not add To generate a web page that will refresh request on the URL or IP address rather than using an external web service to update a page outpu.
@RalphBacon
@RalphBacon 6 жыл бұрын
You can certainly add that line, Mark, and it will repeatedly reissue the request to the server (same as pressing F5 every few seconds). But I'm not clear on what you mean by "using an external web service to update a page output". The web server (your Arduino) still has to send back the *entire* (HTML) page to your browser (unless we go down the AJAX/JSON route which is not part of this demo but would be infinitely more efficient, but also, for non-programmers, quite involved). Let me know if I've missed something here, as it's not a simple concept for many Arduinites and maybe others are following this great question too!
@thepvporg
@thepvporg 6 жыл бұрын
Thought you were using an external website to poll the server, may be I missed interpreted something, maybe.
@RalphBacon
@RalphBacon 6 жыл бұрын
Ah ha! Well I hope I've cleared up any confusion here. It's your browser talking *directly* to your overworked Arduino web server (via your wifi network), which in turn serves up the updated web page back to your browser. An ESP8266-based board has more "grunt" and memory and would be a better choice but this was a demo for an Ethernet shield for an Arduino, so that's what I used! Thanks for responding so quickly Mark, and I hope it's now as clear as clear can be!
@thepvporg
@thepvporg 6 жыл бұрын
Will have to see how I go on my next duty cycle !
@electrarticle2890
@electrarticle2890 Жыл бұрын
Hello, it is very helpfull, but it not worked on my project. I can not see any design on pc. I checked my module, it is working with another program. and i can make ping the module. regards
@RalphBacon
@RalphBacon Жыл бұрын
Your Ethernet Module should always work if powered up, even if not connected to the Arduino. If the network lights flicker you know it is connected.
@sumanjha1951
@sumanjha1951 7 жыл бұрын
Great tutorial, thank you sir. I am working on this. I need enc ethernet module and sd card work together, so that all html and large file i can put in sd card. Problem is when i am including sd library (sd.h) my ethernet doesn't work. May be because of SPI CS pin. I am using Arduino due, it had dedicated two CS pins but then also it is not working. I even tried tinyFat library, but as my Arduino version is 1.8.1 its shows eeprom.h missing error. Please help me how i can do
@RalphBacon
@RalphBacon 7 жыл бұрын
Hmm, if both devices are on the SPI bus and you have chosen two different CS pins (and ensure only ONE is active as a time) then it should work, Suman. I think (but can't remember) that one of my Ethernet cards has an SD card attached... but that might be an LCD screen. If you connect these up individually they work according to you. If you just remove the CS line to each one in turn do they work (the one that still has a CS line)? Have a look at my video #22 on SD cards to see if that helps you identify the root cause.
@haithamsaleh6680
@haithamsaleh6680 Жыл бұрын
I have a server with multi IP addresses (20), connected with a switch,i need to ping those addresses always . through Ether net connection, i wanna use ARDUINO ETHERNET SHIELD W5100 with arduino uno , in case of failure communication with any address , a SMS , message ore E-mail to be sent
@RalphBacon
@RalphBacon Жыл бұрын
Good luck with your project.
@cheetahkid
@cheetahkid 7 жыл бұрын
Hi Ralph, I been tinkering to find out why isn't my Ethernet working? I'm a noob for a start with the Ethernet, you are my first. Does MAC had to be fixed on one six hexadecimal, I tried any other but it failed to work, so I left it with "0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED" (DEAD BEEFFEED, lol!). Any queries why? I used W5100 Shield from keyestudio. If you use the UIPEthernet library, it may not work perfectly on W5100, so I changed it with Ethernet library. (Remove UIP on #include and it is now #include ). And secondly it will crashed when I pressed "clear" on the Edge Browser and "Refresh" isn't showing, found it the buffer was a little too low so I increased to 120 (was 100). Working ok now. Great video.
@RalphBacon
@RalphBacon 7 жыл бұрын
Glad you got it working Cheetahkid, at least I think that is what you ended up saying! Regarding the MAC address, it can be any 6 hex values (apart from all FF) but in the Real World manufacturers buy and register the first 3 numbers as "theirs", then build a unique MAC address into their products starting with those 3 unique values plus 3 further ones (which they just increment for each one of their products, giving them over 16 million numbers) ensuring that each network card (for instance) has a 100% unique MAC address. When *you* assign a MAC address to a W5100 (because it does not have one) your router has to add it to the list including the IP address you decide to use - which is why I say don't keep changing them as your router will get upset. Decide upon a set of numbers (both MAC and IP address) and stick with them fur-ever (pun intended)! From your PC you can always trying 'pinging' the ethernet address too, to ensure it can be found by your router. Anyway, sounds like you have it all sorted now, so thanks for posting your success story, good to hear from you.
@grahamjohnston2658
@grahamjohnston2658 3 жыл бұрын
What I need to do next is to send a file by email rather than a text message. Is this something that you have covered in another video? I have done it using the Raspberry Pi and it works fine. I am so over the moon that this works with the ESP8266. It has been like finding your way out of a labyrinth and now seeing the exit. Great. So sorry to hear about Benny, we lost our Jasmine a year ago and she is missed so much.
@RalphBacon
@RalphBacon 3 жыл бұрын
I cover mail in the very next video #75 (kzbin.info/www/bejne/oWqUZYOQqK6KadU ) and secure Gmail in video #140 (kzbin.info/www/bejne/qWqUZJJtf72katk ) . Enjoy!
@MrJamesbowen
@MrJamesbowen 7 жыл бұрын
I've always had problems with the W5100 shield where it will not correctly power on unless it is powered via PC USB.
@RalphBacon
@RalphBacon 7 жыл бұрын
Hi James, I'm about to try out my W5100 shield tonight so I'll be able to report back. Thanks for the heads-up!
@RalphBacon
@RalphBacon 7 жыл бұрын
Hi James, I had a chance to play with this tonight, with success. My W5100 shield is connected in the normal manner onto a UNO clone and powered by a 9V/2A wall plug PSU. When I switch the power on the whole things lights up like a Christmas Tree and a few seconds later it has sent me an email. So maybe your W5100 is not so stable, or requires a better PSU? I an only speculate but can confirm my setup is fine. An interesting point you make though, it remains to be seen whether any one else cares to comment on the problem you've experienced.
@RalphBacon
@RalphBacon 7 жыл бұрын
I'm not using DHCP as I don't want the IP address to change, obviously! But maybe that is the issue, inasmuch that the W5100 is doing more work? I'm not quite sure what that capacitor is doing, as RST is always held high by a pull up resistor - the capacitor will only ensure it remains at a high level for longer, which then indicates it *could be* a power related problem if Vcc drops? If I come across the issue I'll certainly let you (and everyone on my channel) know!
@RalphBacon
@RalphBacon 7 жыл бұрын
That's interesting James. As I say, I'm not using DHCP and I've not had a problem so if I get enough time I'll change one of my W5100 sketches to use DHCP just to see. I still reckon that it's your power supply. I too have had issues with my 433Mhz receiver when powered from the USB hub (so the opposite of the problem you have) but which works fine from a Power Bank. Some of those 5v wall warts can be terribly noisy which would be disastrous for networking - have you got a 'scope to check it? Or try another from a well known brand. Or, in your sketch, delay firing up the W5100 for a few seconds. I can't identify from the W5100 shield schematic exactly where it's getting its power as the Vin, +5v and +3v3 are all connected but it would almost be worth supplying power to these programmatically. It would be interesting to get to the bottom of this.
@MrJamesbowen
@MrJamesbowen 7 жыл бұрын
Well this is embarrassing. I thought I only had a problem with DHCP only but the problem still exists with Static IP address as well. I'm starting to believe the problem is in fact with the W5100 shield itself. This might also explain why the capacitor hack does not work either. I tried adding delay statements in my code and I tried using using USB battery supply.
@jensschroder8214
@jensschroder8214 3 жыл бұрын
Better with a ESP3282? More ram avible.
@RalphBacon
@RalphBacon 3 жыл бұрын
I'm not sure it would necessarily be "better" in that way. This is an old video now but one of these was a shield for an Arduino, was it not? So designed for an UNO. These days I think we'd use either an ESP8266 or an ESP32 if we needed internet connectivity.
@mariow9978
@mariow9978 4 жыл бұрын
Hey nice video. I tried out your program, but i can't open the server in my web browser. But i can ping it from the comand promt. Do you have an idea why ?
@RalphBacon
@RalphBacon 4 жыл бұрын
Did you include the port as part of the URL? Eg 192.168.1.3:81 (or whatever port number you are running on)
@hirsutusi5536
@hirsutusi5536 Жыл бұрын
Increase the buffer size on line 123 in the .ino to 150. You can also tidy-up line 136, increase count to 23.
@fatmalalfy7450
@fatmalalfy7450 5 жыл бұрын
Hello Ralph I need help and I would be very grateful to you ..i want to connect two arduinos together using ENC28J60 sending message from one arduino and the other arduino receive the message and display it on lcd..can you give me the guide line to how to do this?
@RalphBacon
@RalphBacon 5 жыл бұрын
Yes, Fatma, you can connect the two Ethernet boards together using a CROSSOVER patch cable (not a normally wired ethernet cable) and the two boards will then talk to each other as though they were on a network. You just address each board with its IP Address (that you define in your sketch). That said, there are easier ways to get two Arduinos to communicate, for an example see video #106 which describes the RS486 protocol and is VERY easy to use.
@pauloe8pck830
@pauloe8pck830 7 жыл бұрын
Hi Ralph, Are you going to do anything further with the ESP8266? I have an idea for a project which might be of interest for a number of people and I have not been able to realize this project due to lack of knowledge about Java Script. I have some finished code that measure the ambient Temperature with a DS18S20 and sends it to a web page directly on my Phone or Tablet. I want to be able to replenish the Temp. information say every 2 seconds and hen plot the Temp. info on a moving graph which starts at the ambient temp. When I push a button on the ESP8266 then the ambient temp.(10 readings divided by ten) should be recalculated and the moving graph line show any variation from this starting temp.. I need this for model gliding to show when a Thermal is approaching. AlI really need are the bare bones of the tablet display which is coded at the TX end I think.. Not too sure about Java Script etc. Any chance of you having a look at this project?
@RalphBacon
@RalphBacon 7 жыл бұрын
Well, yes and no, Paul. I always have "plans", for the ESP8266 and for other things. The trouble is I rarely get the chance to do much with my plans when you consider I have a dayjob and then (try and) run this channel. So if the opportunity arises I'll do another video on this flexible unit (or module). Now... Regarding refreshing the web page every few seconds you should look at a previous video of mine where I already show how to do this (video #36 or #37, one of those). No JS required. The graph is more involved and that is something you need to research and ask for help in the Arduino forum (forum.arduino.cc/index.php) who are chomping at the bit to help others help themselves - but don't expect them to do the work for you, they will help with hurdles. That's the best advice I can give at this stage. When I win the lottery I'll do this channel all day!
@pauloe8pck830
@pauloe8pck830 7 жыл бұрын
Thanks Ralph, I will have a look at the #36 and #37. Regarding the graph, I have no idea where to begin but perhaps someone will do something like it one day.Most of the Forum guys give good advice but not about what you want, just that you have spelt something wrong or forgotten a decimal Point. ;_). Sorry to be so synical but I have my experiences with Forums.
@RalphBacon
@RalphBacon 7 жыл бұрын
I hear you, Paul. Some of the forum experts are keen to put down beginners, with comments such as "Did you even Google that?", when the poor OP doesn't even know what s/he is supposed to be asking! All s/he knows is that her/his code doesn't work. Some are *very* good and have great websites (Nick Gammon for one) that deserve a good read. I read one of his SPI/I2C articles on a flight to Germany recently. The flight only took 5 minutes, amazing how time flies when you're engrossed!
@RalphBacon
@RalphBacon 7 жыл бұрын
Given that JS runs in the client (your browser) this may indeed be your answer. Bear in mind that your browser than has to get the data for each chart point - in their example (point 4) they skim this by adding random data directly from the client but you need to query the server again for that data (eg a refresh, but much better would be an Ajax call, which you'll have to read up on - it's not rocket science but it requires a certain level of knowledge. As a starter look at including jQuery in the browser which then simplifies all the JS stuff anyway, including making Ajax calls.). Yes, I know, Paul, you're trying to do a lot but if you persevere there's no reason why this will not work. Get the example running first! Let me know if you get stuck.
@pauloe8pck830
@pauloe8pck830 7 жыл бұрын
OK, will do Ralph... thanks very much for your answer.
@megapwn333
@megapwn333 5 жыл бұрын
Can you still have multiple slaves on the SPI or do you have to dedicate the spi to ENC28j60 ?
@RalphBacon
@RalphBacon 5 жыл бұрын
I didn't test this, Mantas, and it might work but read this first: forum.arduino.cc/index.php?topic=81855.0 Perhaps newer versions of the ENC28J60 have updated the design. The only way to know is to try it out.
@xmisslightsonmain
@xmisslightsonmain 5 жыл бұрын
I added the library’s and loaded this code to an Arduino nano with a ENC28J60. I can ping the ip and I can see that the web server is trying to show a page via serial command but I can never actually get a page to load any tips?
@RalphBacon
@RalphBacon 5 жыл бұрын
So you're trying to get to the webpage via your browser (or phone) and nothing displays, Shane? Does the 'loading' symbol just keep rotating? If you stop the page loading and look at the page source have you received a partial page (of HTML)?
@xmisslightsonmain
@xmisslightsonmain 5 жыл бұрын
@@RalphBacon thanks for the reply correct i tried this on my phone and pc web browser (chrome and explorer) in chrome i get this error:ERR_CONNECTION_RESET if i stop the page a take a look there is nothing in the page.
@RalphBacon
@RalphBacon 5 жыл бұрын
Are you using the correct port? By default it is port 80, in which case you do nothing special, but if you are using a different port (eg 81, or 8080)) then you must append it to the URL eg: 192.168.1.45:81
@xmisslightsonmain
@xmisslightsonmain 5 жыл бұрын
@@RalphBacon ive tried port 80,81 and 1000. i also took if off my network and set up with a dumb switch with the Arduino and PC
@RalphBacon
@RalphBacon 5 жыл бұрын
When you say you "tried" those ports, are those the ports you tried in the code for the server to run on? So your code will look like: EthernetServer server = EthernetServer(1000); or whatever port you decided upon, and you used this port in the browser's address line too? And once you had created the HTML for the page you executed a sendStaticPage(client); If you used my demo code EXACTLY it will work, as long as your browser address appends the correct port as I showed above.
@dekipet
@dekipet 6 жыл бұрын
How to set CS on MEGA to pin 53?
@RalphBacon
@RalphBacon 6 жыл бұрын
The CS pin is by default pin 53 on the Mega (part of the SPI group of pins), so just leave it as an output pin (even if you don't use it) and it should be fine. I'm guessing a bit as you don't provide a context as to what you are doing or what the problem is, but I hope it helps.
@dekipet
@dekipet 6 жыл бұрын
I know that. Question was for UIPEthernet library and Mega. When i connect CS pin to 53 how to tell ENC28J60 module that CS is not on pin 10, but on pin 53? With examples on Mega and connections as they are, i can not make ethernet module to work. I connect all as it should (pins 50-53) but can not make it work on Mega. Ethercard library works with the same wiring so it is not a problem. Mega is ok, module is ok, wiring is ok, network connection is ok. UIPEthernet+Mega is a problem. Do i have to include Mega somewhere in driver, or to assign CS pin to 53? Or should i have to add some extra lines in sketch for Mega?
@RalphBacon
@RalphBacon 6 жыл бұрын
Well now, the ENC28J60 module doesn't know which pins are connected to the SPI hardware pins; that is all taken care of in the file: C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\mega Here you will see a declaration of "static const uint_t SS = PIN_SPI_SS" which has been defined previously in the same file as pin 53. The ENC28J60 simply uses the definition of SS for its own internal use - it doesn't know if that is pin 53 or pin 10. So, if you are having problems I would suggest that you debug the sketch to print out to the Serial Monitor what pin SS is assigned to so you can see it. If it is 53 (as it should be if you have selected the correct board) then SPI should "just work". Additionally (or alternatively) try doing this with an Arduino Uno (or clone) if you have one and see what difference that makes, if any. Let me know how this goes!
@dekipet
@dekipet 6 жыл бұрын
I haven't change anything in that file you point in. Module works fine with Uno. Module works fine with Mega but with Ethercard library. It doesn't work at all with UIPEthernet library. In Ethercard library i had to set SS pin to 53 in driver and that's all. With this library i can not make it work with Mega. As i mention already wiring is ok as it works with Ethercard. I don't know how to check and debug SPI problem with Mega. Neither to check if it use 53 pin for SS or something else. If no luck, i will jump on W5100 or W5500.
@RalphBacon
@RalphBacon 6 жыл бұрын
In your setup() routine just do: Serial.print("SS pin set to:");Serial.println(SS); That will print out the pin being used for the SS (which should be 53 but may have been overridden somewhere).
@thomasvnl
@thomasvnl 7 жыл бұрын
If you want I could help you with a bit of code that is focused on mobile devices first. This comment being the placeholder/reminder to do such a thing if you'd like
@RalphBacon
@RalphBacon 7 жыл бұрын
Hey Thomas, thanks for the offer! I'll keep this comment here to remind me if I ever get in the position of needing help (what I really need is *time* but that's probably dealt with by Him above so I'm stuck with my 24 hours a day!). Thanks for the offer, appreciated, and I'll let you know if I want to take it up :)
@thomasvnl
@thomasvnl 7 жыл бұрын
That's all right. I forked your repository on Github.com so I might make some alterations to your html.h soon and create a pull request for you to use ;)! Keep making those videos
@thomasvnl
@thomasvnl 7 жыл бұрын
Hej Ralph, could you explain why you are using the UIPEthernet library again as an answer to this comment/in the description of the video? I was able to make it all work with the Arduino Ethernet library (which isn't as big in size as UIPEthernet). I've created some new HTML code but it sort of requires more space to be available than UIPEthernet allows (at least, that's what it looks like at the moment).
@thomasvnl
@thomasvnl 7 жыл бұрын
I think I figured out why, because of the module right, because it isn't a W5100?
@RalphBacon
@RalphBacon 7 жыл бұрын
Totally correct! But wait for my next video when we discuss this in more detail. And I am not happy!
@shahbaztech7064
@shahbaztech7064 2 жыл бұрын
It's gives error
@RalphBacon
@RalphBacon 2 жыл бұрын
That is a shame.
@hirsutusi5536
@hirsutusi5536 Жыл бұрын
Hello Shahbaz, Might be nice to know what the error was. Increase the buffer size on line 123 in the .ino to 150. You can also tidy-up line 136, increase count to 23. And, of course, make sure you are talking to the correct port.
@zodak9999b
@zodak9999b 7 жыл бұрын
We seem to be using the same words for numbers after all... after millions come billions and trillions.
@RalphBacon
@RalphBacon 7 жыл бұрын
Hey zodak999b, you're right, my bad. Wikipedia tells me: *Previously in British English (but not in American English), the word "billion" referred exclusively to a million millions (1,000,000,000,000). However, this is no longer as common as earlier, and the word has been used to mean one thousand million (1,000,000,000) for some time.* However, I'm still not sure how to say that huge number for the possible MAC addresses available? I think *gazillion* should be the official name! :)
@tubeDude48
@tubeDude48 Жыл бұрын
Part 2 #75
@RalphBacon
@RalphBacon Жыл бұрын
Well, I guess so, it shows how to send email from your Arduino.
@tubeDude48
@tubeDude48 Жыл бұрын
@@RalphBacon - Got it, thanks!
@electronicprojectspune3523
@electronicprojectspune3523 4 жыл бұрын
where is the code
@RalphBacon
@RalphBacon 4 жыл бұрын
The code is in my DropBox which you can access here: www.dropbox.com/sh/u6srbe5ook1y2db/AACN9hQODMhq9V4De04h6btPa?dl=0
@electronicprojectspune3523
@electronicprojectspune3523 4 жыл бұрын
thank u sir for reply
#73 nRF24L01 Send (and receive) data with your Arduino!
37:09
Ralph S Bacon
Рет қаралды 202 М.
#257 Wireless Serial Comms⚡for your Arduino (or other μController)
29:40
У ГОРДЕЯ ПОЖАР в ОФИСЕ!
01:01
Дима Гордей
Рет қаралды 7 МЛН
#80 Scrolling LED Matrix MAX7219 *Updated*
30:16
Ralph S Bacon
Рет қаралды 17 М.
Arduino Ethernet Shield Webserver
24:46
BINARYUPDATES
Рет қаралды 113 М.
98- Interfacing ENC28J60 Ethernet Controller | MPLAB XC8 for Beginners Tutorial
23:11
StudentCompanion Electronics
Рет қаралды 24 М.
#72 Arduino controlled Dual PWM controller & Timer thoughts
34:31
Ralph S Bacon
Рет қаралды 19 М.
You’ve Never Seen WiFi Like This
20:43
Data Slayer
Рет қаралды 838 М.
How to connect the ENC28J60 to an Arduino - [Anything Arduino] (ep1)
11:27
Ethernet for the microchips W5500 and ENC28J60. MQTT
21:34
Электроника в объективе
Рет қаралды 89 М.
I2C with Arduino and Raspberry Pi - Two Methods
30:13
DroneBot Workshop
Рет қаралды 203 М.