Get Arduino variable into JavaScript

This is a bit of an odd question, but I am trying to make a mission control software for my model rocket flight computer. I want to use HTML, CSS, and JavaScript to make that. I get readings from an MPU6050, and store them in 3 variables, pitch, roll, and yaw. Is there any way I can get those variables (floats) into JavaScript so I can display them on a web page? My arduino is Arduino Nano

What’s your arduino ? how will you connect your browser to the rocket ?

Arduino Nano. That is what I am also wondering. Maybe somehow bluetooth? I am really lost as to how to go about this.

could you change to an ESP32 which has onboard WiFi, Bluetooth classic and BLE?
you could set an ESP32 up as a access point and run a web page on it, e.g. esp32-access-point-ap-web-server

You won’t get TCP-IP through Bluetooth on your nano…

An ESP32 would be able to create its own WiFi network and so you would be able to connect with your browser but then the question is how far away do you need this connection to work? I assume your rocket will take off and so you need something working at quite a distance. WiFo then won’t do and you need a better radio system

I just need it before it launches ro ensure that the readings are correct.

So i can do the same thing with an ESP32 that i have been foing with my Nano in terms of using the MPU6059, and write to 2 servos? If it can i would definitely switch

Where is the web server which serves the html pages? Is it running on the Arduino or a separate machine?

It will most likely be running on a seperate machine, my laptop;.

My question is if I can use the ESP32 for the same thing I am currently using my Arduino for, as asked above. Because I can figure out how to connect it to a web server I just need to know if it will also function normally. Also, is it easily powered? How could I power it with LiPo?

In that case you can use any connection method you want from from laptop to arduino to read the values. Bluetooth, wifi, other radio frequencies. If you only need the values before launch you could even design some sort of contact which disconnects at launch (like a couple of pads on the bottom of the rocket which sit onto some pads on the base) then use a physical wire to connect.

I think the easiest way to then get the values into the HTML would be to save them into a text file then read the contents of that file using javascript.

That's a good idea having it connected. I was thinking i could have the USB connected, but if I had the Arduino connected to the battery, and then I connected the USB, would the be too much power and might destroy it? Could you also look at my question above? :slight_smile:

Why not just use a serial connection? If you can connect it.

Or bluetooth serial, small on board module.

a7

Yes, that's what I meant, using serial. But also, as I said before, if the ESP32 can do all the things that the Nano can do, I will use that to create a web server because that will take very very much hassle out of this. Also, my rocket will not be going very high.

I think a nano will automatically select whichever power supply gives the higher voltage (but check the spec sheet first) so it won't cause any problems having a usb connection and external power supply also.

An ESP32 would work also. I think most of them need 3.3 volts supply (again, check the spec for your specific board) so you might need another voltage regulator or something added.

Yeah, I'm most likely going to switch to the ESP32. Here is a LiPo battery: https://www.amazon.com/gp/product/B08HD33ZKB/ref=ewc_pr_img_1?smid=A3JZ0E8P9D7DI&psc=1. Would those power the ESP32 without any added boost converters or would I need them?

I have run a LSM9DS1 9-axis iNEMO inertial module off a ESP32 without problems
Never ran servos though

Just googled, servos should run perfect. Do you know anything about the Wi-Fi range for this thing? LIke if it was serving as an AP

You'd be best using a voltage regulator. I looked up the spec sheet for a random ESP32 board and it says the absolute maximum input voltage is 3.6volts and recommended is 3.3 volts. I don't know if other versions have built-in regulators so best check for the exact model you have.

Yeah, right now I am stuck on which one to buy on Amazon. They are all a little bit different. Does it really matter?