-
@Gordon That worked, thanks! I didn't know println existed. I need to read the documentation more closely.
-
I would like to append a \r\n to my JSON.stringify before submitting the values to Serial1. I have:
function getSensorData() { var resTemp = getResTempValue(10); var roomTemp = 98.00; var ph = 58; var ec = 700; outputSensorData(resTemp.toFixed(2), roomTemp, ph, ec); } function outputSensorData(resTempVal, roomTempVal, phVal, ecVal) { var sensorData = {resTemp:resTempVal, roomTemp:roomTempVal, ph:phVal, ec:ecVal}; Serial1.print(JSON.stringify(sensorData)); }
My Terminal window shows the json properly. However, every time the json data gets sent, the next line shows right next to the earlier json data instead of underneath. I need to append a \r\n so the string that is sent will show on the next line. How do I achieve that?
-
@Gordon piping the data to Serial1 worked. I can now view the settings and sensor data in real time by piping it out to my Wifi module then out to my TCP server on the internet.
-
@Gordon how much traffic does this website consume every month?
-
-
@Gordon have you considered accepting donations?
-
What I would like to achieve is to store settings into a config file preferably in json format into a config file of some sort(maybe settings.js?) Which will then get loaded and updated/saved onto a sdcard.
Does anyone have an example that I can work from?
I managed to get this far. However, I am stuck at how to pipe the data to the console screen. If possible, I would like to eventually pipe the file data to a serial port and also pipe data from the serial port to the file located on the sdcard.function re() { var f = E.openFile("settings.js","r"); if (f !== undefined) { f.pipe(console.log(f)); //<--Need to stream to console and serial port. } else { console.log("What?"); } }
At the moment, the console is only receiving: {}. Inside the settings.js file I have:
{"sensors":[{"phHigh":60},{"phLow":58},{"ecHigh":800},{"ecLow":700},{"tempHigh":90},{"tempLow":50}]}
The console.log should output the contents of settings.js, but instead console.log only outputs { }.
-
-
@azrobbo @Gordon I attempted to solder the small sockets. I tried hot air and the dragging method without any success. I tried pointed tip, small chisel and large chisel. I can get the solder to stick by using a flux pen, however, the drag method creates bridges between a few pins. I tried using the copper wick to soak up the excess solder, but the pins are so small I can't get the solder to wick fully. I think my xPico project is now a bust since I can't get a socket to solder to the breakout. Any other ideas that I could try?
-
My boards arrived today. The boards seem like good quality. However this is my first PCB order so I'm not two sure what "good quality" really is. I don't have a flux pen at the moment and will purchase one tomorrow from the electronics store around the corner from me. Here is a top and bottom picture of one of the boards. I will post another when I am finished assembling.
-
@badxhabit I have had a bit of experience using ph sensors with the Espruino; however, I do not have any example code at the moment. I have used the ph sensor from http://www.atlas-scientific.com and I recently just purchased the LeoPhi from http://www.sparkyswidgets.com. The PH sensor from sparkyswidgets is on backorder so I haven't received it yet. Also, the ph sensor from sparkyswidgets is opensource and openhardware. I tend to navigate more towards opensource/hardware to support the the opensource movement. I will get back to you with my findings on the LeoPhi once I receive it.
I would recommend that you hook up a temperature sensor to get a temperature compensated ph results. Temperature compensated ph results give more of an "accurate" reading than just a ph reading. I use the analog temp sensor from atlas-scientific with success. I also posted my temp sensor code in the forum which can be found here: http://forum.espruino.com/conversations/1572/#comment29544
When you have the time can you respond back letting us know how you like the PH sensor that you purchased?
-
Code that works:
function onInit() { var cmd=""; Serial1.setup(9600/*baud*/); Serial1.onData(function (e) { console.log("RX Data: " + e.data); }); function getResTempValue(x) { var temp=0; var avgTemp=0; var tfixed=0; for (var i=0;i<x;i++) { var vOut = E.getAnalogVRef() * analogRead(A0); // if you attached VOUT to Ao var vZero = 0.4; var tCoeff = 19.5 / 1000; var tempinc = (vOut - vZero) / tCoeff; var tempinf = tempinc * (9 / 5) + 32; temp = temp + tempinf; console.log(temp); console.log(i); } temp = temp / x; tfixed = temp.toFixed(2); console.log("Temp: " + tfixed); return temp; } getResTempValue(10); } onInit();
-
-
-
@azrobbo A quick update. I took your advise about posting my question on the eevblog.com/forum; and after chatting back and forth with a user, they helped me create a board using eagle cad. I sent the board info over to iteadstudio to get the board manufactured. It has only been a week since I sent the info to be manufactured so I hope within a week or two I should get a response via email if the boards have been shipped. with UPS shipping it cost cost me 43$ USD for 10 boards and two extra since I checked the opensource option.
-
@azrobbo thanks for taking the time to respond to my question. The connector has 20 pins on the left and 20 pins on the right. Basically I would need something like the Bellin Dynamic Systems SMT adapter boards, but with smt pads that support right and left pins with only one side of breakout out pins.
-
I downloaded eagle cad and the Hirose eagle cad library from element14 website. The eagle cad library doesn't have the DF40C (2.0)-40DS-0.4V (51) connector. If it did I still would not have the slightest idea where to begin with making the break out board. I also looked at the smt schmartboards and couldn't find a solution. I would be willing to donate money to anyone who would be willing to make an eagle cad file so I can send it out to a PCB manufacturer.
-
-
I'm interested in using lantronix xPico WiFi module(http://www.lantronix.com/device-networking/embedded-device-servers/xpico.html)to the Espruino. The WiFi module uses a 40-pin Board-to-Board SMT Connection to interface with it. Does anyone know of a place where I can buy a 40 pin board-to-board to a 40 pin header so I can use jumper wires to interface with the Espruino? I might be able to manufacture it my self; however, I have never used PCB software before.
-
-
-
-
Life happened so I put my project to the side for a couple of months. I decided to pick the project back up today and updated the firmware on the Espruino. By the way I really like the new GUI of the IDE :-)
The issue I am having is toFixed(2) doesn't seem to get the decimal place to only two decimal places. toFixed(2) seemed to work before I took a break from my project.
I hit the Send to Espruino button. I get the following output.
_____ _ | |_ ___ ___ _ ||___ ___ | |_
-| . | _| | | | | . | ||| || |_|||_|_||_| http://espruino.com 1v64 Copyright 2014 G.Williams
echo(0);
80.66461538461538793853833340108394622802734375 0
161.403076923076923776534385979175567626953125 1
241.99384615384616381561500020325183868408203125 2
322.7323076923076996536110527813434600830078125 3
403.54461538461538339106482453644275665283203125 4
484.209230769230771329603157937526702880859375 5
564.83362900747715684701688587665557861328125 6
645.49824439209260162897408008575439453125 7
726.0890136228617848246358335018157958984375 8
806.62281160369502686080522835254669189453125 9 Temp: 80.662281160369502686080522835254669189453125
=undefinedCODE:
function onInit() { function getResTempValue(x) { var temp=0; var avgTemp=0; for (var i=0;i<x;i++) { var vOut = E.getAnalogVRef() * analogRead(A0); // if you attached VOUT to Ao var vZero = 0.4; var tCoeff = 19.5 / 1000; var tempinc = (vOut - vZero) / tCoeff; var tempinf = tempinc * (9 / 5) + 32; temp = temp + tempinf; console.log(temp); console.log(i); } temp = temp / x; temp.toFixed(2); //<-- Doesn't seem to work. console.log("Temp: " + temp); return temp; } getResTempValue(10); } onInit();
@Gordon are there any plans for the future to create a smaller Espruino board like the size of the Teensy++ 2.0?